Cross-Origin Isolation with COOP and COEP
Serving both Cross-Origin-Opener-Policy: same-origin (COOP) and Cross-Origin-Embedder-Policy: require-corp (COEP) places a document into an isolated OS process (self.crossOriginIsolated === true). That boundary prevents Spectre memory-reading attacks, unlocking SharedArrayBuffer, Atomics, and high-resolution performance.now() timers.
COOP + COEP Cross-Origin Isolation Matrix
Toggle COOP, COEP, and subresource CORP/CORS headers to inspect crossOriginIsolated status and blocked embeds.
Under the Hood
COOP and COEP work like a cleanroom airlock: COOP locks the side door so cross-origin popups cannot share your process, and COEP inspects every incoming crate so no uninvited cross-origin bytes enter your memory space.
- COOP (
same-origin): Severswindow.openerreferences to cross-origin windows, forcing separate browsing context groups and OS processes. - COEP (
require-corp): Blocks any cross-origin image, script, iframe, or CORS fetch that lacksCross-Origin-Resource-Policy: cross-originor valid CORS headers. - Unlocked Primitives: Once
crossOriginIsolatedistrue, the engine exposes SharedArrayBuffer and sub-millisecondperformance.now()precision.
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corpProblem Genealogy
- 2018 (Spectre CPU Side-Channel): Any attacker
<iframe>sharing a renderer process could read secrets from cross-origin images or scripts in memory using high-resolution timers. - 2020 (COOP + COEP Shipping): Browsers tied
SharedArrayBufferto explicit opt-in process isolation. - 2022+ (
COEP: credentialless): Added a softer mode in Chromium and Firefox that strips cookies from cross-origin fetches instead of requiringCORPheaders everywhere.
Production Pitfalls
- Breaking third-party embeds: Payment widgets, YouTube iframes, and CDN avatars without
CORPorCORSfail to load underrequire-corp; scope COOP/COEP to heavy Wasm/editor routes rather than the entire marketing site. - OAuth popup
window.opener === null:COOP: same-originbreaks popup-based OAuthopener.postMessage(); handle OAuth on a same-origin redirect page and signal the main tab via BroadcastChannel.
- When not to use Cross-Origin Isolation: Standard CRUD apps that do not run multi-threaded Wasm (
SharedArrayBuffer) gain little from COOP/COEP while paying steep third-party embed compatibility costs.
Connections & Logical Next Steps
COEP relies on CORS or Cross-Origin-Resource-Policy opt-ins before loading cross-origin subresources.
Browsers gate SharedArrayBuffer and microsecond performance.now() precision behind crossOriginIsolated.
Browsers gate SharedArrayBuffer behind crossOriginIsolated to mitigate Spectre timing attacks.
CORS governs JS response readability; COEP/CORP governs embedding binary resources in isolated processes.