-
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: add modify obstructive user agent code for electron to strip el… #22958
feat: add modify obstructive user agent code for electron to strip el… #22958
Conversation
…ectron and cypress out of the UA string.
Thanks for taking the time to open a PR!
|
@@ -0,0 +1,50 @@ | |||
// @see https://github.com/cypress-io/cypress/issues/22953 | |||
// We modify the user agent to strip cypress and electron out of the user agent string to appear more chrome-like |
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.
do we need to strip out cypress
? I thought it wasn't causing any issues and only electron
was? Or are we just stripping out all non-standard parts of the referrer?
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.
Just stripping out non standard parts of the user agent. Seems weird to keep it in there but currently there aren't ill adverse side effects with keeping it as far as we know
…m:cypress-io/cypress into normalize-obstructive-user-agent-electron
…e-obstructive-user-agent-electron
…t override passed in user agent via config
Test summaryRun details
View run in Cypress Dashboard ➡️ 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 |
…iveThirdPartyCode over experimentalSessionAndOrigin
…ng issues in CI with parallelization between parent/child processes
…e-obstructive-user-agent-electron
|
||
beforeEach(function () { | ||
userAgent = '' | ||
electron._getUserAgent.callsFake(() => userAgent) |
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.
doing a callsFake
over returns
since userAgent
is assigned dynamically in the test.
cy.origin
integration tests for Google Authentication #21474.User facing changelog
Modifies the Electron user agent to strip
Cypress
andElectron
references when theexperimentalModifyObstructiveThirdPartyCode
flag is enabled.Additional details
The goal here is to update the user agent to appear more chrome like. This should work around currently obstructive authentication mechanisms, currently Google with Electron and avoid 403s. The fix hear was tested on Windows 10 with Electron 18, Linux Mint 22 with Electron 18, and MacOS Monterey with Electron 18. The user agent looks to be edited appropriately and is no longer 403ed by Google
Steps to test
run
test-unit
inside the server package to run the electron unit tests. run theuser_agent_override
cypress test inside the driver with theexperimentalModifyObstructiveThirdPartyCode
flag set totrue
How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?