Repository navigation
Report permissions on project writes; throttle API-key last_used_at - #489
Merged
Merged
Conversation
PUT and PATCH /projects/{id} now carry the caller's `permissions`, as the
detail route does, so a UI that saves a project does not have to re-read it.
Restriction is read from the saved project, so locking a project you are not
a member of answers with only the view permissions.
authenticate_api_key refreshed last_used_at and committed on every request.
It now writes at most once per API_KEY_TOUCH_INTERVAL (5 minutes) per key;
the column feeds idle-key judgements made in days.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two small, independent API fixes left over from the RBAC rollout.
1.
PUT/PATCH /projects/{id}return the caller'spermissionsThe detail route reports what the caller may do in a project, but the write routes returned
permissions: null, so a UI that saved a project had to re-read it to keep its controls right.Both routes now fill the field through the same
effective_project_permissionscall as the detail route (_with_permissionsinapi/project/routes.py).Restriction is read from the saved project, not from the project loaded before the write. A save can change
restricted. An administrator who is not a member and locks a project can, from that point, only view it. The response then listsproject:read,sample:readandproject:manage_members, and no longer offers actions that would answer 403.POST /projectsis unchanged and still returnsnull; the list routes still leave it unset to avoid an N+1. TheProjectPubliccomment anddocs/RBAC.mdare updated to match.2.
authenticate_api_keyno longer writes on every requestEvery API-key request set
last_used_atand committed, so each call made a database write and commit, even a read. The column is now refreshed only when it is empty or older thanAPI_KEY_TOUCH_INTERVAL(5 minutes).Everything that reads it (idle-key review,
list_service_accounts.py,create_service_account.py) works in days, so 5-minute precision loses nothing. Thedocs/RBAC.mditem that flagged this is struck through.Tests
test_rbac_admin.py:PUTandPATCHreturnpermissions.test_api_keys.py:last_used_at" test still passes.Full suite on a clean
git archiveextract: 1530 passed. flake8 clean.🤖 Generated with Claude Code