|
| 1 | +# ---------------------------------------------------------------------- |
| 2 | +# | Cross-Site Scripting (XSS) Protection | |
| 3 | +# ---------------------------------------------------------------------- |
| 4 | + |
| 5 | +# Protect website reflected Cross-Site Scripting (XSS) attacks. |
| 6 | +# |
| 7 | +# (1) Try to re-enable the cross-site scripting (XSS) filter built into most |
| 8 | +# web browsers. |
| 9 | +# |
| 10 | +# The filter is usually enabled by default, but in some cases, it may be |
| 11 | +# disabled by the user. However, in Internet Explorer, for example, it can be |
| 12 | +# re-enabled just by sending the `X-XSS-Protection` header with the value |
| 13 | +# of `1`. |
| 14 | +# |
| 15 | +# (2) Prevent web browsers from rendering the web page if a potential reflected |
| 16 | +# (a.k.a non-persistent) XSS attack is detected by the filter. |
| 17 | +# |
| 18 | +# By default, if the filter is enabled and browsers detect a reflected XSS |
| 19 | +# attack, they will attempt to block the attack by making the smallest |
| 20 | +# possible modifications to the returned web page. |
| 21 | +# |
| 22 | +# Unfortunately, in some browsers (e.g.: Internet Explorer), this default |
| 23 | +# behavior may allow the XSS filter to be exploited. Therefore, it's better |
| 24 | +# to inform browsers to prevent the rendering of the page altogether, |
| 25 | +# instead of attempting to modify it. |
| 26 | +# |
| 27 | +# https://hackademix.net/2009/11/21/ies-xss-filter-creates-xss-vulnerabilities |
| 28 | +# |
| 29 | +# (!) Do not rely on the XSS filter to prevent XSS attacks! Ensure that you are |
| 30 | +# taking all possible measures to prevent XSS attacks, the most obvious |
| 31 | +# being: validating and sanitizing your website's inputs. |
| 32 | +# |
| 33 | +# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-XSS-Protection |
| 34 | +# https://blogs.msdn.microsoft.com/ie/2008/07/02/ie8-security-part-iv-the-xss-filter/ |
| 35 | +# https://blogs.msdn.microsoft.com/ieinternals/2011/01/31/controlling-the-xss-filter/ |
| 36 | +# https://www.owasp.org/index.php/Cross-site_Scripting_%28XSS%29 |
| 37 | + |
| 38 | +add_header X-XSS-Protection $x_xss_protection always; |
0 commit comments