-
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
feat: Selective CSP header stripping from HTTPResponse #26483
feat: Selective CSP header stripping from HTTPResponse #26483
Conversation
I'd like to use this time while the PR is in draft to discuss potentially exposing a configuration option allowing the selective stripping of certain CSP directives, with the goal being to The only reason to consider this is to make this feature opt-in, with an eye to changing the default in a future release. I would most definitely need some guidance as to how to best implement any global config setting, but in the end, we may not even want to expose a config property at all. I'll leave it up for discussion. EDIT
|
d3e70e6
to
2706a5e
Compare
4a5f223
to
ee0269b
Compare
25 flaky tests on run #45566 ↗︎
Details:
e2e/origin/navigation.cy.ts • 1 flaky test • 5x-driver-electron
e2e/origin/user_agent_override.cy.ts • 1 flaky test • 5x-driver-electron
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox
project-setup.cy.ts • 1 flaky test • launchpad-e2e
The first 5 flaky specs are shown, see all 15 specs in Cypress Cloud. This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
ff189fc
to
6d5cf91
Compare
Implementation for the config parameter is blocked by #21151. It seems that the server restart is either:
I would imagine that it's the later. EDIT |
6d5cf91
to
255fc11
Compare
255fc11
to
81164af
Compare
Everything here works when you set the This PR stands on it's own, and hopefully (since the parameter is setup the same way as |
Hi @pgoforth 👋, thanks for this contribution! I'm planning on bringing it up next week with the team so we can discuss it. |
@AtofStryker Looks like the snapshots for the new system tests I wrote need updating, and I had to update a unit test. I do not know how to run the system tests and update the snapshots. I'm rebasing off |
f473888
to
1b5b4fb
Compare
- Add additional system tests - Update snapshots and unit test
1b5b4fb
to
e1142ec
Compare
@pgoforth taking a look and should have it updated soon |
* specified will remain in the response headers. | ||
* | ||
* Please see the documentation for more information. | ||
* @see https://on.cypress.io/configuration#experimentalCspAllowList |
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.
@mschile since this isn't making it into today's release you may have to handle it for the next release
@emilyrohrbough I think this is ready for another look. I needed to tweak the system tests a bit but I think they provide ample coverage. We also added |
…30/pgoforth/load-site-witout-csp-header-stripping
…30/pgoforth/load-site-witout-csp-header-stripping
@pgoforth we are working on getting a few additional reviewers for this PR on Monday. TLDR there is a test that is failing in CI on your branch, but we believe it is due to flake since the same commits on a different branch owned by cypress ICs seems to work fine. This should be going into |
@AtofStryker That all sounds great. I'm OOO next week, but will have my machine with me while I'm traveling. Let me know if there's anything I can assist with and will do my best to help out. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
User facing changelog
Content-Security-Policy
andContent-Security-Policy-Report-Only
header directives via thestripCspDirectives
config option.Additional details
nonce
to inline script injectionnonce
policy value to each CSP headerscript-src-elem
,script-src
, anddefault-src
directive if provided in original responsecontent-security-policy
andcontent-security-policy-report-only
header strippingframe-ancestors
because it prevents Cypress from loading target into iframeparseCspHeaders
methodstripCspDirectives
that permits selective stripping of individual CSP directivesstripCspDirectives
config option maintains existing CSP header strippingSteps to test
How has the user experience changed?
This change does not affect UI/UX
PR Tasks
cypress-documentation
?Documentation for
stripCspDirectives
type definitions
?