|
| 1 | +--- |
| 2 | +"@aws-blocks/bb-auth-basic": minor |
| 3 | +"@aws-blocks/auth-common": minor |
| 4 | +"@aws-blocks/blocks": patch |
| 5 | +--- |
| 6 | + |
| 7 | +AuthBasic now revokes the session token server-side on sign-out. Each session |
| 8 | +JWT carries a unique `jti`; `signOut` records that id on a revocation list (in |
| 9 | +the existing codes store, expiring with the token) so a replayed cookie is |
| 10 | +rejected even though the JWT is still unexpired and signature-valid. The |
| 11 | +umbrella `@aws-blocks/blocks` is bumped because the bundled `bb-auth-basic` |
| 12 | +README/DESIGN docs it mirrors have changed. |
| 13 | + |
| 14 | +This is a `minor` (not `patch`) bump because it adds exported error constants — |
| 15 | +`AuthBasicErrors.SessionRevoked` (`SessionRevokedException`, thrown by |
| 16 | +`requireAuth` for a signed-out/revoked session, vs `SessionExpiredException` for |
| 17 | +an absent/aged-out one) and `AuthBasicErrors.SignOutIncomplete` |
| 18 | +(`SignOutIncompleteException`, 503, thrown when the revocation write fails) — |
| 19 | +and documents a new throwable name on the shared `BlocksAuth.requireAuth` |
| 20 | +contract in `@aws-blocks/auth-common`. |
| 21 | + |
| 22 | +`signOut` always clears the local cookie (so sign-out on this device never |
| 23 | +leaves the user stuck signed in), even when the server-side revocation write |
| 24 | +fails; in that case it throws a stable `SignOutIncompleteException` rather than |
| 25 | +the raw SDK error, so no `$metadata`/ARNs leak to the client. |
| 26 | + |
| 27 | +Legacy-surface behavior change: the deprecated `buildApi().signOut` previously |
| 28 | +always resolved to `{ success: true }`; it now awaits `signOut` and so can |
| 29 | +reject with `SignOutIncompleteException` (503) when the revocation write fails. |
| 30 | +Only direct `buildApi` callers are affected — the `createApi()` state machine |
| 31 | +catches it into the `AuthState.error` field. |
| 32 | + |
| 33 | +Operator note: the `codes` store gains `{ ttl: true }`. For an already-deployed |
| 34 | +AuthBasic app this is an in-place DynamoDB TimeToLive enablement (an `UpdateTable`) |
| 35 | +on the next `cdk deploy` — no data migration, and correctness does not depend on |
| 36 | +the reaper (reads filter expired items regardless). Caveat: DynamoDB rejects |
| 37 | +another `UpdateTimeToLive` on the same table for ~1 hour after a change, so if an |
| 38 | +unrelated resource fails in the same deploy, CloudFormation rollback (which |
| 39 | +disables TTL) — or a deploy → rollback → redeploy within that hour — can land in |
| 40 | +`UPDATE_ROLLBACK_FAILED`. Deploy AuthBasic apps with this in mind. |
0 commit comments