-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nova requires CSP unsafe-eval permission #1933
Comments
It should not be a problem for nova to use this fonts but include them locally and shipping them directly with nova. https://google-webfonts-helper.herokuapp.com/fonts/nunito?subsets=latin |
We will not be hosting the Nova JS externally. This is something that you could configure yourselves by overriding the Nova views to look for a different path, though. |
This one caught me out too, thanks for the fix @Synchro |
Does anyone have a way around adding |
Unfortunately I've had to leave it with the worst-case |
That sucks. I just patched together a system where Nova gets |
@jbeales how did you manage to do that? |
Oh, I've done that too in other contexts, using nginx. First create a map that has a default value, and a regex to match the pages you want to use a different CSP for, and the CSP contents you want for each (you can have as many of these entries as you like in the map):
Then in any location that uses it:
It will automatically pick the CSP policy that matches the request URL |
@sebastianmacarescu I'm using spatie/laravel-csp, and have 2 Policy classes, my Then I have spatie/laravel-csp set to use the Main policy, but in If you're not using spatie/laravel-csp you can use the same approach - set your main CSP in a middleware, then add an additional middleware that adds unsafe-eval to Nova using that middleware nova config option. |
Description
This is a deployment issue caused by overall code structure, rather than any specific bit of code.
If you have a very strict CSP policy like this:
Nova will load its login page, but shows a blank grey page after login, and throws these two errors:
The error can be avoided by allowing
unsafe-eval
inscript-src
, however, allowing that along withunsafe-inline
means you're losing all the XSS defences that CSP provides.I know that this isn't a simple thing to work around because removing
unsafe-inline
requires moving all JS out to external files, andunsafe-eval
can be tricky to avoid, but since Nova is an admin panel, I think it would be good if it avoided preventing the use of good security measures that would otherwise be usable - XSS in admin interfaces is a common attack vector.Steps To Reproduce
unsafe-eval
to thescript-src
section, so it becomesscript-src 'self' 'unsafe-inline' 'unsafe-eval' ;
.It would be good to avoid using google fonts too - they are typically regarded as trackers, and it's fiddly to have to enable them only for Nova. I know they're pretty, but falling back to local static or standard web fonts would be preferable for an admin interface.
The text was updated successfully, but these errors were encountered: