-
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
Integrity resources are being blocked #30657
Comments
Hi @DoctorOaken. Can you send your full cypress config (with anything sensitive filtered out)? I'm curious what other config values are being set. Also, how is that asset being loaded? Is it part of the HTML or being Forking Cypress Test Tiny makes sharing a reproducible example easier to share and easier for our engineers to replicate your issues. This method also keeps the reproduction as simple as possible, which helps us eliminate potential causes and noise from the investigation. |
Hello, Thanks for your reply. We have put together a sample of the tests attached to this reply. |
Hi @ryanthemanuel The asset is just part of the HTML on page, it's a React script Here's our fork for the test: We get the integrity error with the config as it is there. Just a guess, but I think it has something to do with a |
Thanks for the reproduction and theories. That was super helpful. I do think there's a bug in our source rewriting capabilities, but I was able to find a workaround that will work for this scenario. If you add this: cy.intercept('GET', '*main*.js', (req) => {
req.continue((res) => {
res.body = res.body.replaceAll('window.top', 'self')
})
}) Basically, this will replace the problematic I'll keep the issue open since it appears we can do better with our rewriting logic. |
@ryanthemanuel updated Fork: What we get now is an integrity error on a script that is created by an inline script on the page: I've been scratching my head trying to think of a way around that, but I'm coming up with nothing |
I noticed another thing on that page (one-page-checkout.asp) That script doesn't seem to load properly with |
Current behavior
We have been attempting to use this configuration
experimentalSourceRewriting: true
However when we run our automation we run into this error
Failed to find a valid digest in the 'integrity' attribute for resource 'https://www.xxxxxxxxx.com/js/script.js' with computed SHA-384 integrity 'HASH'. The resource has been blocked
Desired behavior
The resource loads and then the page loads.
Test code to reproduce
We cannot provide this directly, but is there a way we could demonstrate the test?
Cypress Version
13.15.1
Node version
22.9.0
Operating System
Windows 11 , reproducible in Ubunut 20.04 LTS
Debug Logs
No response
Other
We believe we are running into the same problem mentioned on this thread.
#29111
as well as this one
#18315
We tried using these configurations
experimentalSourceRewriting: true and/or modifyObstructiveCode: false,
but we continued to run into the same integrity resource being blocked error.
Attached as a screenshot of the log of the test result.
The text was updated successfully, but these errors were encountered: