Phase 3: Backend Hardening #414

Closed
opened 2026-02-16 16:56:52 +00:00 by jason.woltje · 0 comments
Owner

Parent Epic: #411

Stories

  • 3.1 Extract trustedOrigins to getTrustedOrigins() with env vars
  • 3.2 Align CORS config in main.ts to use same origin list
  • 3.3 Update session config: 7d absolute, 2h idle timeout, explicit cookie attributes
  • 3.4 Add TRUSTED_ORIGINS, COOKIE_DOMAIN to .env.example

Acceptance Criteria

  • trustedOrigins from env vars (NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_API_URL, TRUSTED_ORIGINS)
  • CORS and trustedOrigins use same origin list
  • Session: expiresIn=7d, updateAge=2h, httpOnly, secure, sameSite=lax
  • .env.example documents new variables
  • All new code has tests (85%+ coverage)
  • pnpm lint && pnpm typecheck && pnpm test pass

Files

  • apps/api/src/auth/auth.config.ts
  • apps/api/src/main.ts
  • .env.example
## Parent Epic: #411 ## Stories - **3.1** Extract trustedOrigins to getTrustedOrigins() with env vars - **3.2** Align CORS config in main.ts to use same origin list - **3.3** Update session config: 7d absolute, 2h idle timeout, explicit cookie attributes - **3.4** Add TRUSTED_ORIGINS, COOKIE_DOMAIN to .env.example ## Acceptance Criteria - [ ] trustedOrigins from env vars (NEXT_PUBLIC_APP_URL, NEXT_PUBLIC_API_URL, TRUSTED_ORIGINS) - [ ] CORS and trustedOrigins use same origin list - [ ] Session: expiresIn=7d, updateAge=2h, httpOnly, secure, sameSite=lax - [ ] .env.example documents new variables - [ ] All new code has tests (85%+ coverage) - [ ] pnpm lint && pnpm typecheck && pnpm test pass ## Files - apps/api/src/auth/auth.config.ts - apps/api/src/main.ts - .env.example
jason.woltje added this to the Auth-Frontend-Remediation (0.0.14) milestone 2026-02-16 16:56:52 +00:00
jason.woltje added the securityauthapiapi labels 2026-02-16 16:56:52 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaic/stack#414