package auth import ( "fmt" "net/http" ) // ClientHeader is the header a browser client must send with every unsafe cookie-authenticated // request. Any value; its PRESENCE is the assertion. const ClientHeader = "X-TM-Client" // CSRF guards the cookie path and only it: a Bearer token is not ambient authority, so no // cross-site page can make a browser attach one. // // Two layers, both cheap: // // - http.CrossOriginProtection (stdlib, Go 1.25+) — Sec-Fetch-Site with an Origin/Host fallback. // This is the mechanism STACK_DECISIONS §5 describes, and it now ships with the toolchain, so // we do not hand-roll it. // - a required custom header on unsafe requests that carry the session cookie. The stdlib check // ALLOWS a request bearing neither Sec-Fetch-Site nor Origin, on the reasoning that it is not // a browser. A pre-2023 browser posting a cross-site