-
Notifications
You must be signed in to change notification settings - Fork 3.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
Consider moving away from document.domain to adhere to better security practices #29590
Comments
The solution we are moving forward with, in Cypress 14:
|
Is there a way to test this behavior on existing project before Cypress 14 comes out? |
@alexsch01 This is the branch we're working from, so you could find a commit and download the binary of one of those. It unfortunately doesn't have this work yet though as it's not complete. https://docs.cypress.io/app/references/advanced-installation#Install-pre-release-version |
resolved with #30770 and will be released with Cypress 14 |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
What would you like?
I would like to consider removing document.domain injection and making
cy.visit()
require a full navigation when a subdomain navigation occurs, changing the cookie APIs to set the cookie on the current domain (not super domain), and to better adhere to full origin specifications without strange exceptions when it comes to origin and domain nomenclature.document.domain modification deprecation
The origin specification
Why is this needed?
With the introduction of Chrome 119, Chrome and other browsers now bucket all requests to an origin server with a given Origin-Agent-Cluster key:
Cypress ran into this in it's own system tests in #29391 and we patched a work around internally (see thread on PR).

This means the
Agent-Origin-Cluster
header needs to be set on the first page request. However, this is difficult for Cypress for a few reasons:Cypress only injects into
cy.origin()
or the Application Under Test (AUT). It is sometimes impossible to know when injection is going to be required in the future for a request that has already been sent to an origin server, which gives us two options:Agent-Origin-Cluster: ?0
on every origin server page request, which is not only a bad security practice, but almost guarantees we will be continuing an uphill battle fighting browser security, which we don't want.document.domain
injection, which would likely fix a slew of problems:window.top
domain is set first, which contrasts our best practices on test determinism. Adhereing closer to the browser specification and doing a document reload makes sure cookies are sent in the correct context.cy.origin()
now becomes more clear, which needs to be used on any origin navigation and not odd exceptions like sub domain navigation.Other
No response
The text was updated successfully, but these errors were encountered: