-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only modify js on AUT domain in proxy (#9018)
- Loading branch information
Showing
7 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import e2e from '../support/helpers/e2e' | ||
|
||
describe('e2e proxying spec', () => { | ||
e2e.setup({ | ||
servers: { | ||
port: 7878, | ||
static: true, | ||
cors: true, | ||
https: true, | ||
}, | ||
}) | ||
|
||
e2e.it('integrity check', { | ||
spec: 'proxying_spec.js', | ||
}) | ||
}) |
24 changes: 24 additions & 0 deletions
24
packages/server/test/support/fixtures/projects/e2e/cypress/integration/proxying_spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
describe('proxying', () => { | ||
// load a script that has obstructive code and would otherwise be modified by the proxy | ||
// https://github.com/cypress-io/cypress/issues/8983 | ||
it('does not fail integrity check for cross-origin scripts', () => { | ||
cy.visit('/index.html') | ||
.then((win) => { | ||
/** | ||
* @type {Document} | ||
*/ | ||
const document = win.document | ||
const script = document.createElement('script') | ||
|
||
script.src = 'https://localhost:7878/static/simple_obstructive_code.js' | ||
script.integrity = 'sha256-iVKZPZrzbe7YNdMKYWJ1+f74j5lD3gRFvGjqtLyji6A=' | ||
script.crossOrigin = 'anonymous' | ||
document.head.append(script) | ||
|
||
return new Promise((resolve, reject) => { | ||
script.onload = resolve | ||
script.onerror = () => reject(new Error('script failed to load, check the console. Possibly a failed integrity check')) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
packages/server/test/support/fixtures/projects/e2e/static/simple_obstructive_code.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
(function () { | ||
if (top != self) {console.log('loaded!')} | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5198a86
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.
Circle has built the
linux x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
5198a86
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.
AppVeyor has built the
win32 x64
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally:
5198a86
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.
AppVeyor has built the
win32 ia32
version of the Test Runner.Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.
Run this command to install the pre-release locally: