Security
Authn/z, rate limiting and CORS policies in the Tee Time backend and docs site.
Backend
- Guards: Admin routes require JWT +
@RequireAudience('teetime-admin'). - Rate limiting:
nestjs-rate-limiter(~60 req/min default on many routes). - CORS: Allowed origins constrained to dev and
PROD_UI_ORIGIN; credentials allowed.
IDP & CSRF
- Vite dev servers proxy
/api/auth/*back to the IDP origin (viaVITE_IDP_DEV_ORIGIN) so CSRF cookies remain same-origin (SameSite=Laxin dev,SameSite=None; Securein prod). - Web clients call
GET /api/auth/csrfon the IDP to receiveXSRF-TOKEN. - Auth POSTs include
withCredentials: trueandX-XSRF-Token: <cookie>(double-submit). - Refresh supports cookie-only sessions; clients may POST
/api/auth/refreshwith an empty body (cookies supply session identifiers). - Mobile clients reuse the same cookie session — see the Mobile Expo cookie auth guide
(
docs/mobile/cookie-auth.mdin the monorepo root) for setup, proxy usage, and troubleshooting.
Docs site
- Basic auth enforced at ingress via Traefik middleware (
teetime-docs-basicauth). - Secret
teetime-docs-basicauthin namespaceteetimemust containuserskey with htpasswd entries.