Strict-Transport-Security(HSTS)& X-Frame-Options & X-XSS-Protection

一、Strict-Transport-Security(HSTS)

1、HSTS介绍

        HTTP Strict-Transport-Security(通常简称为 HSTS)响应标头用来通知浏览器应该只通过 HTTPS 访问该站点,并且以后使用 HTTP 访问该站点的所有尝试都应自动重定向到 HTTPS。  

2、语法

Strict-Transport-Security: max-age=<expire-time>
Strict-Transport-Security: max-age=<expire-time>; includeSubDomains
Strict-Transport-Security: max-age=<expire-time>; includeSubDomains; preload

3、指令

max-age=<expire-time>
浏览器应该记住的,只能使用 HTTPS 访问站点的最大时间量(以秒为单位)。

includeSubDomains 可选
如果这个可选的参数被指定,那么说明此规则也适用于该网站的所有子域名。

preload 可选 非标准
查看预加载 HSTS 获得详情。当使用 preload,max-age 指令必须至少是 31536000(一年),并且必须存在 includeSubDomains 指令。这不是标准的一部分。

4、示例

        现在和未来的所有子域名会自动使用 HTTPS,有效期(max-age)为一年。同时阻止通过 HTTP 访问页面或者子域的内容。


                
在springboot项目中修复HTTP Security Header Not Detected 漏洞,并提供验证方式。参考解决方案:Note: To better debug the results of this QID, it is requested that customers execute commands to simulate the following functionality: curl -lkL --verbose. CWE-693: Protection Mechanism Failure mentions the following - The product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. A &quot;missing&quot; protection mechanism occurs when the application does not define any mechanism against a certain class of attack. An &quot;insufficient&quot; protection mechanism might provide some defenses - for example, against the most common attacks - but it does not protect against everything that is intended. Finally, an &quot;ignored&quot; mechanism occurs when a mechanism is available and in active use within the product, but the developer has not applied it in some code path. Customers are advised to set proper X-Content-Type-Options (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Content-Type-Options) and Strict-Transport-Security (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security) HTTP response headers. Depending on their server software, customers can set directives in their site configuration or Web.config files. Few examples are: X-Content-Type-Options: Apache: Header always set X-Content-Type-Options: nosniff HTTP Strict-Transport-Security: Apache: Header always set Strict-Transport-Security &quot;max-age=31536000; includeSubDomains&quot; Nginx: add_header Strict-Transport-Security max-age=31536000; Note: Network devices that include a HTTP/HTTPS console for administrative/management purposes often do not include all/some of the security headers. This is a known issue and it is recommend to contact the vendor for a solution.
07-01
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值