Skip to content

fix(auth): read access JWT from criticalbit_access cookie - #83

Merged
amrtgaber merged 1 commit into
mainfrom
fix/auth-cookie-rename-criticalbit-access
Apr 22, 2026
Merged

fix(auth): read access JWT from criticalbit_access cookie#83
amrtgaber merged 1 commit into
mainfrom
fix/auth-cookie-rename-criticalbit-access

Conversation

@amrtgaber

Copy link
Copy Markdown
Contributor

Summary

  • Rename the cookie this resource server reads from app_access to criticalbit_access, matching the service-scoped name now issued by criticalbit-auth-api#24.
  • Add TestAuthCookie wire-level coverage: mints an RS256 JWT with an ephemeral keypair, patches get_public_key, and asserts (a) a valid criticalbit_access cookie authenticates a request to /v1/user/inventories, and (b) no cookie returns 401. This locks the cross-service cookie-name contract so a future rename or typo fails CI instead of silently 401-ing every authenticated request.
  • Hard cut — no dual-accept fallback. Deploy after the auth-api rename is live in the target environment, otherwise existing sessions will 401 until re-login.

Scope of audit

The logout refresh-token revocation fix from the upstream PR does not apply here — this repo has no logout handler, no refresh-token decode, no fastapi_users.jwt import (it uses raw PyJWT), and no OAuth/CSRF cookies. This service is a pure resource server that verifies RS256 tokens via JWKS from auth-api.criticalbit.gg; it is not an auth provider. The only cross-repo change that lands here is the single cookie read.

Test plan

  • uv run pytest — 26/26 pass locally
  • uv run ruff check . — clean
  • uv run ruff format --check . — clean
  • CI green
  • Post-deploy: confirm /v1/user/inventories works from the frontend in the target env (only meaningful after auth-api#24 is deployed there)

Align the cookie name this resource server reads with the service-scoped
name now issued by criticalbit-auth-api. Hard cut, no dual-accept — must
deploy after the auth-api rename is live in the target environment,
otherwise existing sessions 401 until they re-login.

Adds TestAuthCookie wire-level coverage so a future rename or typo is
caught in CI instead of silently breaking every authenticated request.
@amrtgaber
amrtgaber merged commit e0660bb into main Apr 22, 2026
2 checks passed
@amrtgaber
amrtgaber deleted the fix/auth-cookie-rename-criticalbit-access branch April 22, 2026 03:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant