Public Access
feat(security): accept the auth cookie and guard against CSRF
Core reads the login token from the tbp_access cookie or a Bearer header, whichever verifies, and parses it once per request. Unsafe requests need an X-TBP-Client or Authorization header, CORS allows only the exact frontend origin, and a missing or expired token answers 401 instead of 403.
This commit is contained in:
1 parent
762b7898d3
commit
5d608b72e6
12 files changed
+362
-121
No files matched your search
@@ -37,8 +37,10 @@ To Be Played is split into three repositories:
|
||||
|
||||
Core never issues tokens. It verifies Auth's EdDSA (Ed25519) JWTs with public keys only. It loads them from Auth's
|
||||
JWKS by the token's `kid` and loads again when a new `kid` shows up (at most every 10 seconds). Loaded keys stay
|
||||
until Core restarts. `JWT_PUBLIC_KEY` is used only until the first JWKS load works. Core reads `userId` and
|
||||
`steamId` from the claims.
|
||||
until Core restarts. `JWT_PUBLIC_KEY` is used only until the first JWKS load works. The token comes from Auth's
|
||||
`tbp_access` cookie or a `Bearer` header, whichever verifies first. Core reads `userId` and `steamId` from the claims.
|
||||
`POST`, `PUT` and `DELETE` need an `X-TBP-Client` or `Authorization` header (CSRF guard), and CORS allows only the
|
||||
frontend origin.
|
||||
A token with a `typ` claim (for example a profile ticket) is rejected on normal endpoints; the profile ticket is
|
||||
accepted only by `GET /api/public/profiles/library` in the `X-Profile-Ticket` header.
|
||||
|
||||
|
||||
Reference in new issue
Block a user