-
Notifications
You must be signed in to change notification settings - Fork 0
Public-form CSRF tokens (HMAC + anon-cookie binding) #176
Copy link
Copy link
Closed
Labels
area:apiGo HTTP API serverGo HTTP API serverarea:webNext.js public siteNext.js public sitephase:P1-cms-corePhase 1 — CMS CorePhase 1 — CMS Corepriority:P1Important — should land in phaseImportant — should land in phaseskill:goGo programmingGo programmingskill:securitySecurity expertiseSecurity expertisetype:featNew feature or implementation taskNew feature or implementation tasktype:securitySecurity-related workSecurity-related work
Milestone
Metadata
Metadata
Assignees
Labels
area:apiGo HTTP API serverGo HTTP API serverarea:webNext.js public siteNext.js public sitephase:P1-cms-corePhase 1 — CMS CorePhase 1 — CMS Corepriority:P1Important — should land in phaseImportant — should land in phaseskill:goGo programmingGo programmingskill:securitySecurity expertiseSecurity expertisetype:featNew feature or implementation taskNew feature or implementation tasktype:securitySecurity-related workSecurity-related work
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Implement public-form CSRF tokens per doc 13 §10.1 for comments, plugin-provided contact forms, and search-tracking POSTs. Each form renders with a token that is the HMAC of
(anon-id || form-id || timestamp)signed withauth.session_signing_key. Anon-session is an opaque cookie__site_anon(HttpOnly, SameSite=Lax, Secure, Path=/, max-age 30d). Submit verifies both the token HMAC and the anon-cookie binding.Origin/Referermust match the site origin for state-changing POSTs. High-stakes forms (e.g., password recovery) use single-use tokens.Design reference
Acceptance criteria
__site_anoncookie set on first visit (HttpOnly, SameSite=Lax, Secure, Path=/, max-age 30d, random UUID)anon-id || form-id || timestamp,auth.session_signing_key), 12h validityOriginorReferermatches site origin for state-changing POSTs (rejects mismatched)Dependencies
#105
Complexity
M