OAuth 2.1 PKCE S256 Checklist: Exact Redirects, S256 & Token Security
Validate Authorization Code + PKCE S256 enforcement, exact redirect_uri string matching, sender-constrained refresh tokens, and deprecated OAuth 2.0 flow removal.
Validate Set-Cookie headers against RFC 6265bis __Host- rules (Secure, Path=/, zero Domain= attribute), HttpOnly XSS defense, SameSite CSRF protection, and bounded Max-Age.
| Control / Header | Hardened Baseline | Security & Compliance Rationale |
|---|---|---|
__Host- Prefix |
Mandatory for Session & CSRF Cookies |
Blocks sibling subdomain cookie tossing and origin overwrite attacks (RFC 6265bis §4.1.3.2) |
Domain Attribute |
MUST BE OMITTED for __Host- |
Any Domain=... attribute causes browsers to silently reject __Host- cookies |
Path Attribute |
Path=/ (Exact Root Path) |
Required alongside Secure for browsers to accept __Host- cookie prefix |
HttpOnly + SameSite |
HttpOnly; SameSite=Lax (or Strict) |
Blocks document.cookie XSS exfiltration and cross-site CSRF writes |
Set-Cookie: __Host-sid=eyJhbGciOiJFUzI1NiJ9.opaque; Path=/; Secure; HttpOnly; SameSite=Lax; Max-Age=3600 Set-Cookie: __Host-csrf=9f8a7b6c5d4e3f2a1b0c; Path=/; Secure; HttpOnly; SameSite=Strict; Max-Age=3600
export const SESSION_COOKIE_OPTIONS = {
name: "__Host-sid",
httpOnly: true,
secure: true,
sameSite: "lax",
path: "/",
maxAge: 3600 // 1 hour sliding / 12h NIST AAL2 absolute max
// Note: NEVER set 'domain' on __Host- cookies
};
Validate Authorization Code + PKCE S256 enforcement, exact redirect_uri string matching, sender-constrained refresh tokens, and deprecated OAuth 2.0 flow removal.
Lint OpenID Connect discovery JSON for HTTPS issuers, S256-only PKCE, disabled Implicit response_types, asymmetric JWT algs (ES256/RS256), and RFC 7009 revocation.
Generate compliant RFC 9728 /.well-known/oauth-protected-resource manifests and 401 WWW-Authenticate challenges for remote Streamable HTTP MCP servers and APIs.
Generate FIDO Alliance /.well-known/passkey-endpoints JSON and hardened WebAuthn PublicKeyCredential RP policies requiring residentKey and userVerification.
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.
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.
← Back to AuthPosture Hub · AuthPosture ($39 Fix Pack) → · hub.runglab.dev → · dev.runglab/devtools →
RFC 6265bis strictly forbids the Domain attribute on __Host- cookies so that the cookie is host-locked to the exact origin that set it.
Use SameSite=Lax for primary session cookies so OAuth/OIDC top-level GET navigation still works, and SameSite=Strict for sensitive state-changing CSRF or step-up tokens.
Run a live audit on https://auth.runglab.dev ($39 AuthPosture Fix Pack) or call https://hub.runglab.dev.