-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Figure out how to load site with Content-Security-Policy without stripping header #1030
Comments
|
BTW, it would be nice to stub report violation calls, but since they are not XHR, we would need to #687 to do this. Then it would be sweet! |
We were hoping to test that there were no CSP violations. The way this is currently implemented prevents us from doing so. |
Any update on this one? |
It would be a very useful improvement |
We had some additional discussion for the actual implementation of this improvement here: #7936 (review) Now it just needs to be implemented. |
Extra context: https://glebbahmutov.com/blog/testing-csp-almost/ |
+1 to this. It would be nice to test for CSP violations |
Co-authored-by: Zach Bloomquist <[email protected]> Closes #1030
Co-authored-by: Zach Bloomquist <[email protected]> Closes #1030
Hi @pgoforth. First I want to say thank you for the work you put in on getting #24760. Unfortunately, we have to revert the changes due to some issues we found that I described in the revert request #25445. We are hoping to revisit this soon and find a way to make CSP as compatible as possible with Cypress. We are still discussing options, but for right now we need to revert the change to prevent us from breaking existing users. I hope you understand and once again thank you for the large effort on the contribution! |
@AtofStryker Thanks for these notes. It appears that the course of action should be:
EDIT 2.) I have added a The thought occurred to me while doing this that people have probably written a lot of tests assuming that Cypress is stripping CSP headers. Headers like That brought me to the following idea which could be executed in two ways: EDIT 2 |
Feature proposal
Currently we strip "content-security-policy" when loading documents.
By passing through CSP, and possibly tweaking it, we should be able to add security testing to Cypress.
Observation
using helmet to generate CSP, we can do nothing and just run in report mode.
In the following page we catch two errors:
<head> <script type='text/javascript'> document.domain = 'localhost'; var Cypress = window.Cypress ...
The server receives the following calls from the browser
Which leads me to conclude that we should inject our Cypress top level script from external url and not inline (where it might conflict)
The text was updated successfully, but these errors were encountered: