chromeWebSecurity:false Limitation for Cross-Browser Certificate Validation
0 reputation · 19 Nov 2021, 10:35 UTC
0 reputation · 19 Nov 2021, 10:35 UTC
Run Cypress tests against an internal service that uses a self-signed certificate or a private CA, while maintaining consistent behavior across Chromium, Firefox, and WebKit.
Cypress drives the browser through an internal proxy, so TLS negotiation occurs in the browser. The documented chromeWebSecurity option (default true) can be set to false to relax certificate checks, but this only works in Chromium-based browsers. Firefox and WebKit do not support disabling web security via this flag, requiring the private CA to be installed in each browser's trust store instead.
Teams must decide between weakening test fidelity with chromeWebSecurity:false for Chromium convenience or investing in proper CA provisioning for all target browsers. The trade-off affects mixed-content detection, certificate transparency checks, and how closely the test environment mirrors production.
What is the recommended approach for provisioning a private CA into Firefox and WebKit when running under Cypress? Does Cypress provide any built-in mechanism to inject trusted roots, or must the CA be added to the OS/browser profile manually? Are there version-specific differences in certificate error handling that would change this decision for Cypress 13+?
35275 reputation · 19 Nov 2021, 10:48 UTC
Cypress does not provide a built-in mechanism to inject trusted root certificates into the browser's trust store at runtime. Because chromeWebSecurity: false is a Chromium-specific flag that relaxes security checks rather than establishing trust, the recommended approach for cross-browser consistency is to provision the private CA into the operating system or browser profile before the Cypress runner starts.
Since Firefox and WebKit handle trust stores differently, you must apply a two-pronged provisioning strategy in your CI/CD pipeline or local environment:
update-ca-certificates on Linux or adding to the Keychain on macOS).certs.txt file in the Firefox profile directory to pre-populate trusted roots.The following table outlines the difference between relaxing security and establishing trust:
| Method | Scope | Fidelity | Risk |
|---|---|---|---|
chromeWebSecurity: false |
Chromium Only | Low | Masks CORS and SSL errors that will occur in production. |
| CA Provisioning | All Browsers | High | Higher initial setup complexity in CI/CD pipelines. |
To ensure the CA is correctly provisioned and not merely bypassed, perform these checks:
NET::ERR_CERT_AUTHORITY_INVALID in the browser console. If this persists while chromeWebSecurity is true, the trust chain is broken.chromeWebSecurity: true to validate that your application's CORS and security headers are functioning as expected.For Cypress 13+, there are no new built-in APIs for certificate injection. The underlying behavior of the browser engines (Chromium, Gecko, WebKit) remains the primary driver of how certificates are validated. The decision to move from chromeWebSecurity: false to full CA provisioning is primarily a decision about test fidelity rather than a version-specific requirement.
Diagnostic Detail Needed: Are you using ephemeral Docker containers for your CI runs, or a persistent VM? (This determines whether you should use OS-level installation or profile-level injection via config files).
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.