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

"experimentalModifyObstructiveThirdPartyCode" breaking resource integrity checks and page not loading #30960

Open
LazaroOnline opened this issue Jan 28, 2025 · 0 comments
Assignees
Labels
experimental: modify third party code Issues when using experimentalModifyObstructiveThirdPartyCode Reproducible Can be reproduced stage: needs investigating Someone from Cypress needs to look at this

Comments

@LazaroOnline
Copy link
Contributor

LazaroOnline commented Jan 28, 2025

Current behavior

Cypress with experimentalModifyObstructiveThirdPartyCode set to true breaks the page's SRI (resource integrity) making it unable to load.

Desired behavior

Cypress should be able to load the page https://app.fenergonebula.com just fine, and disable SRI if required.

Either removing the integrity attributes from the <script> tags,
or just don't modifying JS files that were not really needed to modify.
The page loads just fine inside cypress without modifying it,
however for my case the flag experimentalModifyObstructiveThirdPartyCode is required
because the test needs to load Microsof'ts login page,
which is required according to this official guide for AAD.

Since the flag experimentalModifyObstructiveThirdPartyCode is global
and not configurable dynamically,
I can't disable it during the page load.

Making experimentalModifyObstructiveThirdPartyCode configurable during runtime may help in some cases too.

Test code to reproduce

Create a cypress project (current latest version v14)
with experimentalModifyObstructiveThirdPartyCode set to true,
then create a simple test with this code:

cy.visit('https://app.fenergonebula.com/')

The page https://app.fenergonebula.com that normally loads in any browser, doesn't load.
In the console errors you can see that the error is due to
the JS resource integrity checks failing and thus not loading the page's JS:

Failed to find a valid digest in the 'integrity' attribute for resource
Image

It seems like experimentalModifyObstructiveThirdPartyCode
is modifying some of those JS tyring to de-obfuscate it,
but Cypress fails to disable the resource integrity checks.

The target application uses script tags with integrity:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/import-map-overrides.js" integrity="sha384-0bYMu4/iGlEDQ5Qv9gRHYUmeA4dccvzUAosASac3DYtJQLEVfcJaZsZvLKoKgPYx" crossorigin="anonymous"></script>

Cypress Version

14

Node version

v20.8.0

Operating System

Windows 11

Debug Logs

Other

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
experimental: modify third party code Issues when using experimentalModifyObstructiveThirdPartyCode Reproducible Can be reproduced stage: needs investigating Someone from Cypress needs to look at this
Projects
None yet
Development

No branches or pull requests

3 participants