Cross-Origin Embedder Policy
COEP require-corp / credentialless: cross-origin isolation, SharedArrayBuffer, and embedding requirements.
- browser
- coep
- coop
- cross-origin-isolation
- security
Cross-Origin Embedder Policy (COEP) controls whether a document can load cross-origin resources that do not explicitly grant permission. Together with COOP, it enables cross-origin isolation — required for powerful APIs like SharedArrayBuffer after Spectre mitigations.
Docs: MDN COEP, web.dev COOP/COEP, MDN cross-origin isolation.
Why isolation exists
Spectre-class attacks made unrestricted high-resolution timers + shared memory dangerous across origins in the same process. Browsers gated SharedArrayBuffer (and related) on cross-origin isolated contexts:
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Check in page:
console.log(crossOriginIsolated); // true when isolation is active
COEP values
| Value | Meaning |
|---|---|
unsafe-none (default) |
No special embedding restrictions from COEP |
require-corp |
Every subresource must be same-origin or explicitly allow via CORP/CORS |
credentialless |
Cross-origin no-cors requests omit credentials; softer migration path |
require-corp in practice
Cross-origin images, scripts, and frames need either:
- CORS mode + ACAO, or
Cross-Origin-Resource-Policyheader from the resource owner:
Cross-Origin-Resource-Policy: cross-origin
Without that, the resource is blocked under COEP require-corp. This breaks third-party widgets, analytics, and random CDNs until they send CORP/CORS.
<!-- cross-origin image must cooperate under COEP require-corp -->
<img src="https://cdn.example.com/pic.jpg" crossorigin="anonymous" />
CDN must respond with ACAO (for CORS) and/or CORP.
Migration pain (real product)
Turning on COEP is a dependency graph problem: every embed and asset vendor must play along. Order of operations:
- Inventory third parties.
- Prefer
credentiallessif it meets your API needs. - Add CORP on first-party static assets.
- Enable COOP+COEP on a canary.
- Verify
crossOriginIsolated === trueand SAB if needed.
COEP vs CSP vs CORS
- CORS — can JS read the response?
- COEP — may the document embed the resource under isolation rules?
- CSP — allowlists for script/style/etc. as XSS defense.
They stack; fixing one does not replace the others.
Interview out-loud
“COEP require-corp forces embeds to opt in via CORP or CORS so the page can be cross-origin isolated with COOP. That unlocks SharedArrayBuffer. The cost is every third-party asset must cooperate — credentialless eases some migrations.”
SharedArrayBuffer checklist
- Confirm you actually need SAB (audio worklets, WASM threads, codecs).
- Set COOP
same-origin+ COEPrequire-corporcredentialless. - Audit every cross-origin image, script, worker, and frame.
- Add
Cross-Origin-Resource-Policy: cross-originon first-party static assets. - Assert
crossOriginIsolatedin a boot smoke test.
If SAB is a nice-to-have, the isolation migration cost may not be worth it yet.
Related
Further depth
Teams often under-invest in this topic until an incident or CWV regression. Schedule a one-hour drill: reproduce the failure mode in DevTools, list the top three mitigations for your stack, and file tickets with owners. Revisit after the next major feature that touches networking, rendering, auth, or third parties — those are the moments regressions land. Keep primary documentation links in the runbook so on-call is not searching chat history at 2am.
Concrete artifacts to leave behind: a short architecture note, a CI assertion or header snapshot, and a dashboard panel (lab or field) that would have caught the last bug. Teaching the rest of the team the mental model matters as much as the one-line fix.
Further reading
Related guides
- Cross-Origin Opener PolicyCOOP same-origin and same-origin-allow-popups: sever window.opener, process isolation, and OAuth popups.
- Content-Type and MIME SniffingWhy Content-Type matters, how MIME sniffing works, X-Content-Type-Options: nosniff, and XSS-ish pitfalls.
- CORS Explained for FrontendWhy the browser blocks cross-origin responses, what Access-Control-* headers mean, preflight, credentials, and how to fix real frontend errors.
- Feature Policy Legacy NotesFeature-Policy renamed to Permissions-Policy: migration notes, old header syntax, and what still matters.
- Permissions PolicyLock down camera, geolocation, payment, and other powerful features with Permissions-Policy headers and iframe allow.