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:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
| Test | Artifacts | |
|---|---|---|
| delayed navigation > errors > redirects to an unexpected cross-origin |
Output
Video
|
|
e2e/origin/user_agent_override.cy.ts • 1 flaky test • 5x-driver-electron
| Test | Artifacts | |
|---|---|---|
| user agent override > persists modified user agent after cy.go |
Output
Video
|
|
cypress/cypress.cy.js • 3 flaky tests • 5x-driver-electron
| Test | Artifacts | |
|---|---|---|
| ... > correctly returns currentRetry |
Output
Video
|
|
| ... > correctly returns currentRetry |
Output
Video
|
|
| ... > correctly returns currentRetry |
Output
Video
|
|
commands/net_stubbing.cy.ts • 1 flaky test • 5x-driver-firefox
| Test | Artifacts | |
|---|---|---|
| network stubbing > intercepting request > can delay and throttle a StaticResponse |
Output
|
|
project-setup.cy.ts • 1 flaky test • launchpad-e2e
| Test | Artifacts | |
|---|---|---|
| Launchpad: Setup Project > Command for package managers > works with Yarn 3 Plug n Play |
Output
Screenshots
Video
|
|
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 |
There was a problem hiding this comment.
@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-PolicyandContent-Security-Policy-Report-Onlyheader directives via thestripCspDirectivesconfig option.Additional details
nonceto inline script injectionnoncepolicy value to each CSP headerscript-src-elem,script-src, anddefault-srcdirective if provided in original responsecontent-security-policyandcontent-security-policy-report-onlyheader strippingframe-ancestorsbecause it prevents Cypress from loading target into iframeparseCspHeadersmethodstripCspDirectivesthat permits selective stripping of individual CSP directivesstripCspDirectivesconfig 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
stripCspDirectivestype definitions?