Cluster 18 · Email Auth Security · DMARC p=reject · 10m TTL

Magic-Link DMARC & SPF Anti-Phishing Checklist for Passwordless Auth

Secure passwordless magic-link and OTP email flows with isolated auth-mail subdomains, strict DMARC p=reject (adkim=s, aspf=s), SPF -all, and same-browser PKCE binding.

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
Subdomain Isolation auth-mail.<domain> (Never mix w/ marketing) Prevents marketing ESP reputation issues or lookalike campaigns from affecting login emails
DMARC Policy v=DMARC1; p=reject; adkim=s; aspf=s Strictly rejects forged login/OTP emails pretending to originate from your domain
Token Entropy & TTL >=256-bit CSPRNG · <=10 min · Single-Use Store only SHA-256 token hash in DB and invalidate immediately on first POST consume
Cross-Browser Defense __Host-magic_bind Cookie / Same-Session Check Prevents email scanners or forwarded links from signing in an attacker's browser

Auth-Mail Subdomain SPF & Enforcing DMARC DNS Pack

magic-link-dns.txt
; Dedicated Auth Subdomain (auth-mail.acme.example.com)
auth-mail.acme.example.com.       300 IN TXT "v=spf1 include:amazonses.com -all"
_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]"

Enterprise Mail-Scanner Safe Two-Step Magic-Link Form

magic-link-consume.html
<!-- Never consume a magic-link token on HTTP GET (corporate email scanners prefetch GET links!) -->
<form method="POST" action="/auth/magic-link/verify">
  <input type="hidden" name="token_id" value="OPAQUE_SINGLE_USE_ID" />
  <button type="submit">Complete Sign-In to Acme</button>
</form>

Implementation Steps & Key Insights

  1. Send transactional magic links and OTPs from a dedicated subdomain (e.g. auth-mail.<domain>) configured in Mode 4 above.
  2. Publish SPF with HardFail (-all) and DMARC p=reject with strict DKIM/SPF alignment (adkim=s; aspf=s).
  3. Consume magic-link tokens exclusively via an explicit user-triggered POST form (never HTTP GET) to defeat Defender/Proofpoint link prefetchers.
  4. Bind the callback to an initiating browser __Host- session token and test your domain live at https://auth.runglab.dev.
  • Corporate email security gateways routinely visit GET links inside magic-link emails before the user clicks, consuming single-use tokens prematurely unless gated behind POST.
  • Without strict DMARC p=reject, attackers spoof password-reset and magic-link emails to harvest credentials or redirect users to lookalike login pages.

Common OAuth, Passkey & Cookie Pitfalls

  • Consuming single-use login tokens during HTTP GET page render.
  • Leaving DMARC on p=none or sending magic links from the same SPF record as 8 bloated marketing SaaS tools.
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

Why do enterprise users say their magic links arrive 'already expired'?

Enterprise gateways (Microsoft Safe Links, Proofpoint, Mimecast) prefetch URLs via HTTP GET. Fix it by rendering a confirmation page on GET and consuming the token only on POST.

Why isolate magic-link mail onto auth-mail.<domain>?

Subdomain isolation gives login emails clean DKIM/SPF alignment, protects root domain SPF lookup budgets, and enforces DMARC p=reject cleanly.

Can I check both my DNS anti-spoofing and auth headers together?

Yes — audit live on https://auth.runglab.dev ($39 AuthPosture Fix Pack) or https://audit.runglab.dev.