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

fix: ensure multi domain passivity #20442

Merged

Conversation

AtofStryker
Copy link
Contributor

@AtofStryker AtofStryker commented Mar 2, 2022

User facing changelog

n/a

Additional details

To prevent current users from being impacted by the multi-domain work, experimentalMultiDomain config checks have been added in the proxy to prevent any injection/delaying issues for users when they upgrade cypress when multi-domain is released, but aren't actively using it. The goal here is to make sure cross origin behavior with cypress remains the same when multi-domain is not in use.

Most of the code changes are minimal, but tests needed to be updated/added. I added tests for the SetInjectionLevel middleware to help better understand what injections are needed in what cases, as well as to test current injection behavior with/without the presence of configuration options.

While working on multi-domain, we skipped the captures cross origin failures test in navigation_spec as fullMultiDomain was being injected regardless of flag. Since the experimentalMultiDomain config option is now set to true for all driver tests, this test was migrated to a system test to test when this option is false. There are currently some issues replicating this behavior in firefox under system-test, and the test needs to be updated in the future once a suitable testing method is found.

navigation_spec captures cross origin failures results on develop

navigation_spec captures cross origin failuresconverted to system-test running headfully example (slightly different)

While doing work on this issue, I noticed that there was a test in the web_security_spec system test that was passing but should be failing. I adjusted the code to yield the following and hopefully gives us something to fall back on for multi-domain.

How has the user experience changed?

N/A

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Mar 2, 2022

Thanks for taking the time to open a PR!

@AtofStryker AtofStryker changed the title Bugfix: Issue 19882 ensure multi domain passivity fix: Issue 19882 ensure multi domain passivity Mar 2, 2022
@cypress
Copy link

cypress bot commented Mar 2, 2022



Test summary

20210 0 322 4Flakiness 2


Run details

Project cypress
Status Passed
Commit 62fe94d
Started Mar 3, 2022 9:21 PM
Ended Mar 3, 2022 9:34 PM
Duration 13:13 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/commands/net_stubbing_spec.ts Flakiness
1 network stubbing > intercepting response > can 'delay' a proxy response using Promise.delay
2 network stubbing > intercepting response > can 'delay' a proxy response using Promise.delay

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@AtofStryker AtofStryker force-pushed the issue-19882-ensure-multi-domain-passivity branch from dbb6c1b to 33c94d5 Compare March 2, 2022 17:11
@AtofStryker AtofStryker force-pushed the issue-19882-ensure-multi-domain-passivity branch from 33c94d5 to 2f0a428 Compare March 2, 2022 17:45
@AtofStryker AtofStryker force-pushed the issue-19882-ensure-multi-domain-passivity branch from 2f0a428 to e7e5d03 Compare March 2, 2022 18:48
@@ -213,7 +234,7 @@ describe('http/response-middleware', function () {
...props.res,
},
req: {
proxiedUrl: 'http:127.0.0.1:3501/multi-domain.html',
proxiedUrl: 'http://127.0.0.1:3501/multi-domain.html',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out this wouldn't be parsable by the cors.urlMatchesOriginPolicyProps helper. It doesn't have an effect in this test since the remote strategy is set to foo, but figured it would be good to update this incase these tests are updated in the future and this helps discover a potential issue

@@ -40,7 +40,7 @@ const onServer = function (app) {

app.get('/cors', (req, res) => {
res.send(`<script>
fetch('https://127.0.0.2:44665/cross_origin')
fetch('https://www.foo.com:44665/cross_origin')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the snapshot for this test should NOT change

@AtofStryker AtofStryker changed the title fix: Issue 19882 ensure multi domain passivity fix: ensure multi domain passivity Mar 2, 2022
@AtofStryker AtofStryker marked this pull request as ready for review March 2, 2022 19:23
@AtofStryker AtofStryker requested a review from a team as a code owner March 2, 2022 19:23
@AtofStryker AtofStryker removed the request for review from a team March 2, 2022 19:26
@AtofStryker AtofStryker self-assigned this Mar 2, 2022
@@ -13,5 +13,6 @@
"retries": {
"runMode": 2,
"openMode": 0
}
},
"experimentalMultiDomain": true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also be setting experimentalSessionSupport here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mschile sorry I missed this comment! I don't think we need to because it likely would impact the cookie_spec. We can get away with setting experimentalSessionSupport as an override because the server doesn't need the value, which is nice!

Copy link
Contributor

@chrisbreiding chrisbreiding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

system-tests/test/web_security_spec.js Outdated Show resolved Hide resolved
@AtofStryker AtofStryker requested a review from mschile March 3, 2022 21:17
@AtofStryker AtofStryker merged commit ae65ae6 into feature-multidomain Mar 4, 2022
@AtofStryker AtofStryker deleted the issue-19882-ensure-multi-domain-passivity branch March 4, 2022 03:40
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

Successfully merging this pull request may close these issues.

3 participants