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

XSS and CSP "default-src https:" inconsistency in web_security.md #131

Open
polybuildr opened this issue May 31, 2020 · 0 comments
Open

Comments

@polybuildr
Copy link
Contributor

polybuildr commented May 31, 2020

web_security.md says:

  • Aiming for default-src https: is a great first goal, as it disables inline code and requires https.
  • For existing websites with large codebases that would require too much work to disable inline scripts, default-src https: 'unsafe-inline' is still helpful, as it keeps resources from being accidentally loaded over http. However, it does not provide any XSS protection.

This implied to me that default-src https: did provide XSS protection but if you instead use default-src https: 'unsafe-inline', you lose this XSS protection.

However, later in the same document:

# Disable unsafe inline/eval, only allow loading of resources (images, fonts, scripts, etc.) over https
# Note that this does not provide any XSS protection
Content-Security-Policy: default-src https:

This seems inconsistent to me. If I understood the docs correctly, the code snippet should not say "Note that this does not provide any XSS protection".

Edit: After reading through the docs a bit more, I guess even default-src https: does not provide XSS protection because an attacker could inject a <script> with a src to their own https:// link through some other vulnerability? If my updated understanding is correct, then perhaps the earlier reference to XSS protection should be moved up a bullet point?

@polybuildr polybuildr changed the title XSS and CSP "default-src https:" discrepancy in web_security.md XSS and CSP "default-src https:" inconsistency in web_security.md May 31, 2020
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