-
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
Subtle Crypto not available in Firefox #14600
Comments
Throwing this out there too: if it's possible to run Cypress CI tests on different browser versions, that would be a nice workaround in the meantime. Haven't been able to figure that out, doesn't seem possible using the Cypress service |
- Subtle crypto is unavailable in the latest Firefox in Cypress (cypress-io/cypress#14600)
@j-berman We have docker images where some different browser versions are provided, but we don't have a 'matrix' of browser versions to run against. https://github.com/cypress-io/cypress-docker-images We proxy a lot of requests through Cypress, so yeah, I imagine there's something we're not taking into account in this situation. Reproducible example
<html>
<body>
<h1>Hello world</h1>
<script>
console.log(window.crypto)
</script>
</body>
</html>
it('Subtle crypto unavailable', () => {
cy.visit('index.html').then((win) => {
// Fails in Firefox 84
expect(win.crypto).to.have.property('subtle')
})
}) Firefox 81Firefox 84 |
I can find crypto.subtle on 127.0.0.1 in Firefox v84, but not on localhost. |
Same issue here on macOS with firefox 88 and a local server running on localhost:3000 |
The similar issue 127.0.0.1:8080 --> ok But 192.168.0.xxx:8080 ---> undefined |
I'm also having this issue with Firefox 100, Ubuntu 20.04, Cypress 10.0.2 on localhost. Both Electron and Chrome work normally. I tried to polyfill using @peculiar/webcrypto but wasn't able to get it working. |
I'm also seeing this in our CI as of late.
|
I just had the same problem, I found that the |
I got same error on FF only, this fixed. |
I am facing this issue while visiting a RainbowKit v1.5 website at 192.168.1.XXX. Interestingly, my issue is in Brave Browser, but Firefox works okay. I do not get this issue on localhost when I am on the machine that is running the web server. |
Hi @ALL |
hello how to set |
Type about:config in the location (address) bar and press the "Enter" key to open the about:config page, just like you open a website by typing the URL in the location bar. Then search for the setting name in the config search bar. |
Looks like that |
i got issue with window.crypto.subtle
browser: firefox 114.0.2 |
It looks like that should not be necessary @caesar1987sk - we already do this by default:
I suspect serving vias launchOptions.preferences['network.proxy.testing_localhost_is_secure_when_hijacked'] = true; Is it causing errors? |
I tried this out.
Not working: it("runs", () => {
cy.visit("http://localhost:8000");
cy.window().then((win) => expect(win.crypto).to.have.property("subtle"));
}); Working: it("runs", () => {
cy.visit("http://127.0.0.1:8000");
cy.window().then((win) => expect(win.crypto).to.have.property("subtle"));
}); If I add setupNodeEvents(on) {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.family === 'firefox') {
// launchOptions.preferences is a map of preference names to values
// login is not working in firefox when testing_localhost_is_secure_when_hijacked is false
launchOptions.preferences['network.proxy.testing_localhost_is_secure_when_hijacked'] = true;
}
return launchOptions;
});
} in |
Adding this to my cypress config works for me. Thanks 👍🏼 |
I did not end up figuring this out. Anyway, above work around works great. |
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided. |
This issue has been closed due to inactivity. |
Current behavior
Subtle Crypto (
window.crypto.subtle
) is undefined in Firefox 84.First noticed my CI tests in Firefox were failing, then reproduced locally by updating my local Firefox (and Cypress) to the latest.
Desired behavior
Subtle crypto to be available in Firefox Cypress tests.
Test code to reproduce
Versions
Failing CI Versions
Firefox 84
Linux Ubuntu - 18.04
Cypress - 4.12.1
Last known working CI Versions
Firefox 83
Linux Ubuntu - 18.04
Cypress - 4.12.1
Failing Local Versions
Firefox 84
Mac OS X - 10.14.6
Cypress - 6.2.1
Last known working local version
Firefox 78
Mac OS X - 10.14.6
Cypress - 6.2.1
Note
Subtle crypto is supposed to be available at localhost, as it's considered a secure context.
From MDN's docs on secure contexts:
But it also has this note, which seems to be the culprit for the breaking change in Firefox 84, but I'm not really sure why:
I have access to subtle crypto in Firefox 84 when serving my site from a webpack dev server at localhost, just not within Cypress for some reason.
I figure it has something to do with Cypress' browser environment being incompatible with Firefox 84:
The text was updated successfully, but these errors were encountered: