Skip to content

Reject access tokens issued before a per-user cutoff - #9990

Draft
harshithmullapudi wants to merge 1 commit into
mainfrom
superset/per-user-token-block-pr-c88b1cdc
Draft

harshithmullapudi wants to merge 1 commit into
mainfrom
superset/per-user-token-block-pr-c88b1cdc

Conversation

@harshithmullapudi

@harshithmullapudi harshithmullapudi commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Revoking a CLI token in the DB does not stop its 7-day JWT. This adds nullable auth.users.tokens_valid_after. sessionFromOAuthBearer rejects a token whose iat is before it. Null = no effect, other users untouched, JWKS key not rotated.

  • Check is in apps/api/src/trpc/context.ts. It reuses the user row already loaded per request: no extra query.
  • Migration 0199 is a nullable column add with no default (metadata-only). It takes a brief ACCESS EXCLUSIVE lock on auth.users; the db-migrations checklist is not yet cleared, and the migration has not been run anywhere.
  • Not covered: Workers using verifyJWT (relay, realtime) and packages/mcp/src/auth.ts have no DB access and still accept the token until expiry.
  • Tests: bun test src/trpc/isIssuedBeforeCutoff (4 pass).

Summary by cubic

Revoking a CLI token in the DB now stops its 7-day JWT instead of leaving it valid until expiry. This adds a nullable auth.users.tokens_valid_after column; sessionFromOAuthBearer rejects any bearer token whose iat predates the user's cutoff. A null cutoff leaves behavior unchanged, other users are untouched, and no JWKS keys are rotated. The check lives in apps/api/src/trpc/context.ts and reuses the user row already loaded per request, so no extra query is added.

Migration

  • Migration 0199 adds the nullable column with no default and takes a brief ACCESS EXCLUSIVE lock on auth.users; it has not been run anywhere yet.

Not covered

  • Workers using verifyJWT (relay, realtime) and packages/mcp/src/auth.ts have no DB access and still accept the token until expiry.

Written for commit 40df53b. Summary will update on new commits.

View guided diff Turn on auto-fix

Adds nullable auth.users.tokens_valid_after. The API already loads the
user row for every bearer request, so the check adds no query. Null means
no effect.
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

🔗 Preview Links

Service Status Link
Neon Database (Neon) ✅ View Branch
Vercel API (Vercel) ✅ Open Preview
Vercel Web (Vercel) ✅ Open Preview
Vercel Agents Web (Vercel) ➖ Not set up
Vercel Marketing (Vercel) ✅ Open Preview
Vercel Docs (Vercel) ✅ Open Preview

Preview updates automatically with new commits

@expo

expo Bot commented Nov 18, 2026

Copy link
Copy Markdown

Preview update published for development build 0dd268df (fingerprint 08a5e03ce5fb). Open the build on your phone and scan:

Update group 16eec831

This branch was previously deployed

1 inactive deployment
preview — 40df53b9 Deployed Nov 18, 2026 by harshithmullapudi via Deploy Docs #15251
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