Overview
A Content Security Policy (CSP) tells the browser which scripts a page can run and where the page can send data. It is a defense against cross-site scripting (XSS): even if an attacker injects code, the browser blocks scripts and requests that the policy does not allow. If your site sends a CSP, allow the SDK’s script host and the collector endpoint.Allow the Web SDK
<head> of your pages, or send the same policy as a Content-Security-Policy HTTP header.
Combine with SRI
For the strongest protection, use CSP with Subresource Integrity:- SRI makes sure the SDK file has not changed.
- CSP makes sure that only allowed scripts run, and that data goes only to the allowed endpoint.
The dashboard’s CSP
The ManaLens dashboard sends a strict policy with a new nonce for each request: scripts run only with that nonce ('strict-dynamic'), and the page cannot be framed (frame-ancestors 'none'), load plugins (object-src 'none') or post forms to other sites.
The dashboard policy is in Report-Only mode today (
Content-Security-Policy-Report-Only). The browser reports violations to us but does not block them yet. We will switch to enforcement after the reports show no false positives. These headers are enforced now: X-Frame-Options: DENY (no framing), Strict-Transport-Security, X-Content-Type-Options: nosniff and Referrer-Policy: strict-origin-when-cross-origin.