CSP Support—Level 1, Level 2 and Level 3
By 2023, CSP has expanded further, making various additions to the original standard. Each level of CSP introduces more sophisticated security features. CSP level 1 provides the basic framework for defining trusted content sources. CSP level 2 introduces more directives and adds stricter policy enforcement capabilities, while CSP level 3 further refines this with even more directives and enhancements, such as more refined control over inline script execution.
The support for CSP and its different levels varies among web browsers:
Google Chrome: Chrome has supported CSP since version 25. It initially supported CSP level 1 and later added support for CSP level 2 and 3, offering more granular control over script sources and style sources.
Mozilla Firefox: Firefox implemented CSP support starting from version 23. Like Chrome, it has progressively enhanced its support from CSP 1 to CSP 3, aligning with evolving web security standards.
Safari (Apple): Safari began its support for CSP with version 7, initially adhering to level 1 directives. Subsequent versions have expanded this support, incorporating more features from CSP levels 2 and 3.
Microsoft Edge: The original Edge browser, based on EdgeHTML, supported CSP from its early versions, aligning closely with the standards set by CSP level 1 and 2. The Chromium-based Edge, released in 2020, supports CSP levels up to 3, similar to Chrome.
Internet Explorer: Internet Explorer has limited support for CSP, starting from version 10. However, its implementation is less comprehensive than other modern browsers, particularly in regards to CSP levels 2 and 3.
In conclusion, most modern web browsers understand and enforce CSP, with variations in the level of support and implementation. This makes CSP a crucial tool in the web developer’s arsenal for preventing the execution of unauthorized scripts, thereby mitigating risks associated with XSS and other injection vulnerabilities.
Note: When using older browsers, or embedded browsers in a Smartphone app, your rules might break: When using the In-App Browser of your Smartphones‘ Facebook App, Facebook always injects additional JavaScript code, which will break your CSP enabled site. Older browsers from e.g. 2017 might not understand your CSP rules and will also render sites unusable. It is highly recommended to maintain CSP security and strictness and not to reduce either for the sake of compatibility with older browsers.