Skip to content

Subtle Crypto not available in Firefox #14600

Description

@j-berman

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

it('Subtle crypto unavailable', function () {
    cy.visit('./cypress/integration/index.html').then(function (win) {
        expect(win.crypto).to.have.property('subtle')
    })
})

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:

Locally-delivered resources such as those with http://127.0.0.1 URLs, http://localhost and http://*.localhost URLs (e.g. http://dev.whatever.localhost/), and file:// URLs are also considered to have been delivered securely.

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:

Note: Firefox 84 and later support http://localhost and http://*.localhost URLs as trustworthy origins (earlier versions did not, because localhost was not guaranteed to map to a local/loopback address).

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:

Cypress launches the browser in a way that’s different from a regular browser environment. But it launches in a way that we believe makes testing more reliable and accessible.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions