[Feature] : API ENDPOINTS PR 2: Auth#1131
Open
pulk17 wants to merge 2 commits into
Open
Conversation
pulk17
requested review from
canihavesomecoffee and
thealphadollar
as code owners
June 24, 2026 10:28
cfsmp3
self-requested a review
June 24, 2026 16:35
cfsmp3
requested changes
Jun 24, 2026
cfsmp3
left a comment
Contributor
There was a problem hiding this comment.
Missing tests:
- Rate limiter still untested (tests bypass it via TESTING + _rate_limit_store.clear()). The 5/15min create limit is unverified.
- H4 fix (500→JSON) still unverified — no test forces a real route 500.
Bug:
- Non-admins can still request tokens:manage scope (harmless given role gates, but loose).
pulk17
force-pushed
the
api-pr2-auth
branch
6 times, most recently
from
June 26, 2026 19:48
f409134 to
90f415e
Compare
This was referenced Jun 29, 2026
|
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.



[FEATURE]
In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Overview
Second PR of the CI API stack (#1130 → #1141, merge bottom-up). Builds on the auth middleware from #1130 and adds the token lifecycle — the only part of the API usable with just an email and password; everything else requires a token minted here.
Endpoints
POST /auth/tokensGET /auth/tokenstokens:manage+ admin role?all=true)DELETE /auth/tokens/currentDELETE /auth/tokens/{id}tokens:manage+ admin roleDesign decisions
baselines:writeeven by asking for it (403 with the missing scopes indetails). Default expiry 7 days, max 30.tokens:managehere would force every automation token to carry an admin-level scope just to be able to clean up after itself. Revoke-by-id, which acts on other tokens, does require it.IntegrityErrorpath is handled (and tested) for races between the pre-check and the insert.Also in this PR
POST /auth/tokensis the first).tests/test_cifix:test_webhook_prereleasenow mocksrequests.getlike its sibling webhook tests, removing a network dependency.Testing
23 new tests: happy paths, invalid credentials, role/scope rejection, duplicate names, the IntegrityError race, revocation flows (revoked token immediately 401s), and rate-limit/error-handler behavior. 65 total at this layer.