Add CSP Nonce to Nova assets #6901
Unanswered
Radiergummi
asked this question in
Ideas & Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is kind of related to #6349 and #1933; we configured a Content-Security Policy that also applies to Nova routes, which mandates proper script security. This should be best practice for any web application. To satisfy this policy, we add a CSP nonce to all scripts using
nonce="{{ Vite::cspNonce() }}"
. The scripts in the Nova layout, however, don't have the nonce attribute and thus cannot be loaded unless the entire policy is effectively disabled.Currently, we overwrite the layout with our own that adds the nonce to all script tags, but that requires carefully reviewing the upstream layout after every package update and back-port any changes.
Would it be possible to simply add this nonce to the Nova layout template? It doesn't hurt anyone without a CSP, it won't interfere with the legacy Mix setup (AFAIK), and will gracefully degrade if nonces aren't enabled.
For reference, here's our current layout:
resources/views/vendor/nova/layout.blade.php
Beta Was this translation helpful? Give feedback.
All reactions