Skip to content

fix(auth): take JWT sys_admin/support from the user record - #459

Merged
stakach merged 1 commit into
masterfrom
fix/user-record-permissions
Nov 2, 2026
Merged

stakach merged 1 commit into
masterfrom
fix/user-record-permissions

Conversation

@stakach

@stakach stakach commented Nov 2, 2026

Copy link
Copy Markdown
Member

Follow-up to 8779928.

Summary

  • For bearer JWTs, sys_admin/support now come from the user record, and the token's claims are ignored. Before, the record only capped the claims. Now a promotion also applies to existing sessions without the user signing in again, and a demotion still applies straight away.
  • API keys unchanged: a key keeps its stored permissions, independent of its owner's.
  • Unchanged: guest-scoped tokens and MS-exchanged tokens, which are built with non-admin permissions on purpose.

Tests

spec/live_permissions_spec.cr: the promotion case now expects the same token to gain admin and support access.

🤖 Generated with Claude Code

The user record now decides permissions for bearer JWTs, rather than
only capping the token's claims, so a promotion also applies to existing
sessions without the user signing in again. API keys keep their own
stored permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the type: bug something isn't working label Nov 2, 2026
@stakach
stakach merged commit db5fd9c into master Nov 2, 2026
11 checks passed
@stakach
stakach deleted the fix/user-record-permissions branch November 2, 2026 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant