Rule n° 210 - The server sends activation information for protection against cross-site scripting.

Cross-site scripting is an attack that consists of injecting and executing malicious content on a page. Some browsers have built-in filtering mechanisms to protect against certain types of these attacks, mechanisms that can unfortunately be disabled. In order to prevent your site from putting users at risk, it is therefore advisable to force the presence of the protection header and to play it safe for the visitor by blocking all the content of the page.

#Development #Security

Goal

  • Reduce the risk of downloading dangerous hidden content.

Solution technique

Configure the server to send the X-XSS-Protection HTTP header with the value 1; mode=block.

Moyen de contrôle

When it comes to security, you can never take enough precautions. Since some of these so-called cross-site scripting attacks are detectable by browsers, you should not hesitate for a second and use this advantage to the maximum: even if some browsers offer to clean up dangerous content (sanitize), it is better not to take any risks and to explicitly tell them to activate these filters and block the entire page.