A strict app policy and the toolbar
An app may send its own Content-Security-Policy, even default-src 'none'. The forge toolbar is a same-origin script that posts the tell to relative /__forge/… paths on the app's own host, so the forge adds the least that lets it run, only where the policy lacks it:
- A nonce on the directive that governs script tags:
script-src-elemif the policy has one, elsescript-src(built fromdefault-srcwhen absent). The toolbar's tag carries the same nonce, on every policy of a comma-separated header. 'unsafe-inline'is the exception. Browsers ignore it once a nonce is present, which would switch the app's own inline scripts off. There the forge adds'self'instead and no nonce.connect-src 'self'where the policy does not admit it. This is unavoidable: CSP has no source narrower than an origin, and the tell is posted to the app's own origin. It is the only change toconnect-src.
Everything else the app set is left as it was. Content-Security-Policy-Report-Only blocks nothing and is passed through unchanged. A policy that already admits the toolbar ('self', *, its own nonce) is not touched.