-
Notifications
You must be signed in to change notification settings - Fork 129
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 from pentests #4123
CSP from pentests #4123
Conversation
netlify.toml
Outdated
[[headers]] | ||
for = "/*" | ||
[headers.values] | ||
Content-Security-Policy = "default-src https:; script-src https: 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data: blob:; frame-ancestors *" | ||
Content-Security-Policy = "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src https:; img-src https: data: blob:; frame-ancestors *; object-src 'none'; connect-src https:; require-trusted-types-for 'script'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is thr a way to generate nonce for the script-src, style 'unsafe-inline' can work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given we're building a static site, we should use hashes not nonces. Leaving the blog post I shared with you here for us to come back to later: https://dev.to/askrodney/sveltekit-content-security-policy-csp-for-xss-protection-589k
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Perhaps in the future we might try adjusting unsafe-inline
if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a couple questions but looks good!
Cross-Origin-Embedder-Policy = "credentialless" | ||
Cross-Origin-Opener-Policy = "unsafe-none" | ||
Cross-Origin-Resource-Policy = "cross-origin" | ||
X-Frame-Options = "allow-from *" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this X-Frame-Options
? This ChatGPT convo implies allow-from
doesn't support wildcards and the Mozilla docs say the allow-from
directive is deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, but somehow https://securityheaders.com/?q=ui.rilldata.in&followRedirects=on gives it a green :P
@@ -2,7 +2,11 @@ | |||
[[headers]] | |||
for = "/*" | |||
[headers.values] | |||
Content-Security-Policy = "default-src https:; script-src https: 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data: blob:; frame-ancestors *" | |||
Content-Security-Policy = "default-src 'self'; script-src 'self' https: 'unsafe-inline'; style-src https: 'unsafe-inline'; img-src https: data: blob:; frame-src data:; frame-ancestors *; object-src 'none'; connect-src https:;" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was getting Refused to frame '' because it violates the following Content Security Policy directive
https://serverfault.com/questions/945834/refused-to-frame-because-it-violates-the-following-content-security-policy-di suggested data:
and it worked!
No description provided.