-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Test for CSP (Content Security Policy) #565
Conversation
lgtm. I'll keep this open for a week in case anyone has any concerns. |
Isn't this going to trigger a CSP exception? That's going to report errors. |
Confirmed. The |
My test environment doesn't trigger an error and I'm not sure what you mean by false positive http report. |
Make sure |
Interesting. I didn't know about Checking into this with Adam Barth... |
Adam is going to bring this up with the right folks at the spec level. Until then, there's not much |
Being able to silence violation reporting with a try/catch sounds like a security issue itself.
Reporting is pretty critical to deploying CSP in production.
So you're trying to do what exactly? Checking for CSP by triggering CSP violation is just what people will be thinking they are trying to avoid by using this. This detect is just broken. |
Nit: This doesn't actually check to see whether the site has a content security policy set; it's testing the availability of |
I agree with Josh, by the way. I expect larger sites (Twitter, for example) to migrate to CSP by first enabling reporting, and then enabling CSP once they get the initial flood of reports under control. Checking whether I'll poke Adam about this today. I'd like to see an actual API to make the current policy visible in JavaScript. It's a use-case I don't think they've thought about (I hadn't thought about it until today), but one I think we should encourage them to support. |
@josh AFAICT, try/catch doesn't silence reporting. I think we're all in agreement that a feature detect needs to be added to the spec. This patch would only be temporary. |
now this discussion is happening at the standards level: https://mikewest.org/2012/05/content-security-policy-feature-detection going to pull it and add a note that we'll deprecate this test for the real API if/when it comes. |
Test for CSP (Content Security Policy)
Sorry. reread the thread and agree that we can't merge this commit due to it triggering CSP violations. I reverted bringing this test in in f30f011 CSP testing is in limbo until we have firstclass support for it. I'm keep this ticket and #564 closed until a real mechanism is available that doesnt trigger reporting. |
It seems there is a mechanism for this already (see section 3.4.2 of the spec) |
Test for CSP (Content Security Policy)
Fixes issue #564