Cluster 18 · Login Isolation · COOP + frame-ancestors

COOP & CSP Login Clickjacking Shield: frame-ancestors, XFO & Referrer-Policy

Generate hardened login-route HTTP response headers combining Cross-Origin-Opener-Policy, CSP frame-ancestors 'none', X-Frame-Options: DENY, Referrer-Policy: no-referrer, and Cache-Control: no-store.

OAuth 2.1 · WebAuthn · Zero Upload · Strict CSP

4. __Host- Cookies, COOP/CSP & Magic-Link DNS

RFC 6265bis · COOP · DMARC
Session Cookie Hardening Score
PASS
Login Route COOP / CSP Clickjacking Shield (login-headers.txt)
# Hardened Auth / Login Edge Headers for acme.example.com (Cloudflare Pages / Workers)
/login
  Cross-Origin-Opener-Policy: same-origin
  Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self'; form-action 'self' https://auth.acme.example.com
  X-Frame-Options: DENY
  X-Content-Type-Options: nosniff
  Referrer-Policy: no-referrer
  Cache-Control: no-store, no-cache, must-revalidate
  Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
  Set-Cookie: __Host-sid=<CSPRNG_TOKEN>; Path=/; Secure; HttpOnly; SameSite=Lax; Max-Age=3600
Magic-Link DMARC p=reject & SPF -all Pack
# Magic-Link / OTP Subdomain Anti-Phishing DNS & Policy (auth-mail.acme.example.com)
; 1. Dedicated Auth-Mail Subdomain SPF (HardFail -all, <= 10 DNS lookups)
auth-mail.acme.example.com.   300 IN TXT "v=spf1 include:amazonses.com -all"

; 2. Strict Enforcing DMARC on Auth Subdomain + Root Domain
_dmarc.auth-mail.acme.example.com. 300 IN TXT "v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s; pct=100; rua=mailto:[email protected]"
_dmarc.acme.example.com.             300 IN TXT "v=DMARC1; p=reject; sp=reject; adkim=s; aspf=s; pct=100; rua=mailto:[email protected]"

; 3. Magic-Link Runtime Guardrails
- Token TTL: 10 minutes (single-use atomic consume, SHA-256 hashed at rest)
- Browser Binding: Require original PKCE code_verifier or __Host-magic_bind cookie on callback
AuthPosture · OAuth 2.1 & Passkeys $39 AuthPosture Fix Pack

Verify Live OAuth 2.1, OIDC, Passkey & Cookie Posture ($39 Fix Pack)

Run an automated live authentication probe on AuthPosture (auth.runglab.dev) or integrate fleet checks via RungLab Hub API (hub.runglab.dev) and Official MCP Server dev.runglab/devtools — or ship the $39 AuthPosture Fix Pack (tailored OIDC & PKCE S256 patches, RFC 9728 MCP metadata, /.well-known/passkey-endpoints, __Host- cookie rules, COOP/CSP login headers, magic-link DMARC/SPF, and SOC 2 CC6.1 / NIST 800-63B CI gate). Prefer PayPal invoicing? Email [email protected].

Authentication Security Specification & Baseline

Control / Header Hardened Baseline Security & Compliance Rationale
CSP frame-ancestors 'none' Eliminates iframe clickjacking and invisible credential overlay attacks
Cross-Origin-Opener-Policy same-origin (or same-origin-allow-popups) Isolates login browsing context group from cross-origin window.opener tampering
Referrer-Policy no-referrer Prevents OAuth callback ?code=... or magic-link ?token=... from leaking in Referer headers
Cache-Control no-store, no-cache, must-revalidate Prevents shared proxies or browser back-forward caches from storing tokens/HTML

Hardened Cloudflare Pages / Workers /login _headers Block

login-security-headers.txt
/login
  Cross-Origin-Opener-Policy: same-origin
  Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'; frame-ancestors 'none'; base-uri 'self'; form-action 'self' https://auth.acme.example.com
  X-Frame-Options: DENY
  X-Content-Type-Options: nosniff
  Referrer-Policy: no-referrer
  Cache-Control: no-store, no-cache, must-revalidate
  Strict-Transport-Security: max-age=31536000; includeSubDomains; preload

Nginx Auth Location Header Hardening

nginx-auth-headers.conf
location ~ ^/(login|auth|oauth2) {
  add_header Cross-Origin-Opener-Policy "same-origin" always;
  add_header Content-Security-Policy "default-src 'self'; frame-ancestors 'none'; form-action 'self' https://auth.acme.example.com; object-src 'none';" always;
  add_header X-Frame-Options "DENY" always;
  add_header Referrer-Policy "no-referrer" always;
  add_header Cache-Control "no-store" always;
}

Implementation Steps & Key Insights

  1. Open Mode 4 above and choose same-origin (redirect OAuth) or same-origin-allow-popups (if using OAuth popup sign-in).
  2. Restrict form-action to 'self' and your exact IdP origin to block credential-post hijacking by injected form attributes.
  3. Set Referrer-Policy: no-referrer on callback routes so authorization codes never leak to embedded third-party assets.
  4. Verify live login headers on https://auth.runglab.dev or https://audit.runglab.dev.
  • Even with strict script-src, omitting form-action lets an HTML injection redirect your login form submission to an attacker server.
  • Cross-Origin-Opener-Policy prevents malicious opener tabs from retaining window references across OAuth sign-in windows.

Common OAuth, Passkey & Cookie Pitfalls

  • Using COOP: same-origin on popup-based FedCM or Google One Tap popups instead of same-origin-allow-popups.
  • Relying solely on deprecated X-Frame-Options while omitting CSP frame-ancestors 'none'.
Verify Live: Audit your live domain at auth.runglab.dev ($39 AuthPosture Fix Pack), automate via hub.runglab.dev, or connect Official MCP Server dev.runglab/devtools.

More OAuth 2.1, Passkey & Session Security Tools

← Back to AuthPosture Hub · AuthPosture ($39 Fix Pack) → · hub.runglab.dev → · dev.runglab/devtools →

Frequently Asked Questions

When should I use COOP same-origin vs same-origin-allow-popups?

Use same-origin for redirect-based OAuth 2.1 / Passkey flows; use same-origin-allow-popups only on pages that open external IdP sign-in popups needing postMessage back to the opener.

Why is Referrer-Policy: no-referrer critical on OAuth callback endpoints?

If your callback page loads external CSS, fonts, or telemetry before stripping URL params, strict-origin-when-cross-origin still leaks path/origin metadata whereas no-referrer blocks all leaks.

How can I verify live login CSP and COOP posture?

Run a live audit at https://auth.runglab.dev ($39 AuthPosture Fix Pack) or call https://hub.runglab.dev.