Skip to content
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

CSP policy is wrong when whitespace is missing before 'self' #137

Open
danielcl opened this issue Nov 23, 2019 · 0 comments
Open

CSP policy is wrong when whitespace is missing before 'self' #137

danielcl opened this issue Nov 23, 2019 · 0 comments

Comments

@danielcl
Copy link

I just realized that you need to write the policy like this in order for the nonce to work:

policy: {
		"default-src": "'self'",
		"img-src": "'self'",
		"style-src": " 'self' 'unsafe-inline'",
		"script-src": " 'self' 'unsafe-eval'"
	},

Important are the whitespaces before 'self'. If there are no whitespaces it will generate a wrong csp policy and Chrome for example shows a warning like this:

The source list for Content Security Policy directive 'script-src' contains an invalid source: ''nonce-157452790003100'unsafe-eval''. It will be ignored.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant