ProblembuildCsrfCookieHeader sets Secure only when NODE_ENV === 'production'; a staging HTTPS environment in NODE_ENV=development serves the CSRF cookie without Secure.
- Secure flag tied to NODE_ENV, not actual TLS.
- Staging HTTPS insecure cookie.
- Cookie policy drift.
Solution
- Set
Secure when the request is HTTPS regardless of env.
- Centralize cookie attribute logic.
- Test both transports.
Acceptance Criteria
- HTTPS always gets Secure cookies.
- HTTP dev still works.
pnpm --filter api-gateway build passes.
Note for Contributors: Write a clear PR description. Show the transport-aware cookie test.
Problem
buildCsrfCookieHeadersetsSecureonly whenNODE_ENV === 'production'; a staging HTTPS environment inNODE_ENV=developmentserves the CSRF cookie without Secure.Solution
Securewhen the request is HTTPS regardless of env.Acceptance Criteria
pnpm --filter api-gateway buildpasses.Note for Contributors: Write a clear PR description. Show the transport-aware cookie test.