NelmioSecurityBundle icon indicating copy to clipboard operation
NelmioSecurityBundle copied to clipboard

When script-src is set to strict-dynamic, 2 nonces are listed in CSP header

Open eliseeman opened this issue 1 year ago • 2 comments

In the nelmio_security.yaml csp section, we have set script-src to 'strict-dynamic' (while commenting out unsafe-inline), and we are invoking csp_nonce('script') in target pages. yaml When doing so, the Content-Security-Policy header for requested pages lists script-src as 'unsafe-inline' as well as 'strict-dynamic', and two nonces are listed. csp Is there a reason for two nonces in this scenario?

eliseeman avatar Feb 20 '24 18:02 eliseeman

the unsafe-inline is just for compatibility with older browsers not supporting nonces. The two nonces I'm not sure why, maybe you used csp_nonse twice with different arguments? Try to check in the html source where the two nonce values are being used?

Seldaek avatar Feb 21 '24 08:02 Seldaek