Repository navigation
security(auth): SLM authority tokens honour a user revocation (#20446) - #20452
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 14 minutes. View limit details
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. |
✅ SSOT Configuration Compliance: Passing🎉 No new hardcoded values of either class — Known backlog in |
… key refuses an inactive or deleted owner (#20446)
|
Code review on PR #20452 (head 693351c): approve, to land after #20444, whose deactivation writes the marker this reads. Delta since b1fc3d1, read only: the epoch is read fresh on each device call, only the owner lookup is cached 60s, and a store outage fails closed with a 503, for every device: a maintainer decision on #20443. Existing device rows with no owner were not checked. |
Auto-sync: merging
|
| side | commit | subject | issue refs |
|---|---|---|---|
| main | 8e17b7290 |
fix(train): reach floors return to mid-window on the merged tree (#20444) | #20444 |
| this branch | 693351c46 |
chore(guards): re-pin the reach floors the pre-push gate reported stale (#20452) | #20452 |
Refs #20446
Thinking Path
#20443 revokes a deactivated user's tokens with a marker, but SLM RS256 authority tokens never read it, so neither a deactivation nor a password change reaches them. A real signed token confirmed this.
What Changed
autobot-slm-backend/services/jwks_verifier.py:_rs256_user_is_revokedapplies the shared marker check on the full-verify and cache-hit paths. A malformediatis denied, and an unavailable store gives the shared 503.Authority tokens read Redis, where the backend writes, not the SLM's own table. The only RS256 minting site is backend login and refresh, so these tokens name backend-database users. A token with no username or
iatis refused in the verifier.services/jwks_verifier_test.py: the fixture installs an empty marker store, because the existing tests had started reaching real Redis.Device JWTs (maintainer decision):
validate_device_jwtchecks its owner's revocation marker through the shared check (services/device_owner_revocation.py). A missing or soft-deleted owner, or an emptyuser_id, is refused, the soft-deleted case going slightly beyond the decision. A store or lookup failure gives the shared 503;auth_middleware.pyno longer turns that into a 401.SLM API keys (maintainer decision):
get_api_key_userrefuses a key whose user is inactive or deleted. It still has no route callers, so this guards the first one to adopt it.Cost per device request: one extra Redis read for the owner and one for the marker, with the owner cached for the existing 60-second device TTL, so a hard-deleted owner can pass for up to 60 seconds.
Verification
services/jwks_verifier_user_revocation_20446_test.py, with a real signed token: live user admitted; token before the marker refused; token after it, or another user's marker, admitted; cached claims refused; store down gives 503.Tests use separate stores: a marker only in Redis refuses, and one only in the SLM table admits. Without
in_redis=True4 of 9 fail; without the username andiatcheck, 3 fail.62 passed on the verifier, revocation store and neighbouring SLM tests.
Device:
device_owner_revocation_test.py11 passed, 8 failing without the check; with the neighbouring device tests 164 passed. API keys: 5 new tests, 3 failing without the check; 36 passed with neighbours.Not established:
Model Used
Claude Sonnet 5 for implementation, Claude Opus 5.5 for direction
🤖 Generated with Claude Code