Repository navigation
[M2.2d4c2a] Enforce opt-in Bearer access and HTTP quotas - #61
Merged
Merged
Conversation
4 tasks done
samuelmbabhazi
force-pushed
the
feat/m2.2d4c1-api-token-auth
branch
from
November 5, 2026 12:35
116e039 to
5fb43ba
Compare
samuelmbabhazi
changed the base branch from
feat/m2.2d4c1-api-token-auth
to
main
November 5, 2026 12:35
samuelmbabhazi
force-pushed
the
feat/m2.2d4c2a-bearer-http
branch
from
November 5, 2026 12:36
6e186d8 to
a189de2
Compare
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
Users can now create, list and revoke API tokens through session-only
HTTP endpoints. Creation requires password/MFA proof and returns the
credential once; lists return only metadata with bounded cursor
pagination. Revocation is owner-bound and idempotent. All mutations
require Origin and session CSRF.
POST /api-tokens and /api-tokens/{id}/revoke support encrypted
idempotent retries. A creation replay revalidates ownership, account
security version, token lifecycle and owner authority before revealing
the cached token. Revoked/expired/invalidated grants return 409. DTOs
reject unknown scope fields, malformed hierarchy, wildcard permissions,
unsafe labels, invalid dates/cursors and out-of-range page sizes.
OpenAPI/client are regenerated.
Validation: all 84 real PostgreSQL/Docker integration tests pass,
including five new HTTP acceptance cases for encrypted retries,
pagination, session-only access, cross-owner denial, quota enforcement
and rollback on audit failure. All 96 API unit tests, API/client
lint/typecheck/build, client tests, Go tests and buf lint pass locally.
Security: only the explicit creation response exposes plaintext. Neither
metadata lists nor audit events expose hashes/credentials. No dependency
or shell invocation added. Tenant authority/project-owned credentials
remain explicitly tracked under M2.3; before that integration only
profile.read can be granted. Stacked on #61; do not merge automatically.
- [x] M2.2d4c2b criteria met
- [x] Entire integration suite and affected package checks pass
- [x] Generated contract and plan/spec current
- [x] Credential issuance/revocation audited atomically
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.
The global identity guard now accepts Bearer credentials only on explicitly opted-in routes. GET /auth/session allows profile.read and returns account metadata with the token expiry, without issuing session cookies. MFA and other unmarked routes remain session-only.
Malformed or duplicate Authorization headers fail closed and never fall back to a valid cookie. API quotas run before token authentication, including an IP charge for malformed credentials. Session/anonymous mutation Origin and CSRF requirements remain enforced; explicitly permitted bearer requests rely on their header credential. Session-only principal access also checks the principal kind.
Validation: four real HTTP/PostgreSQL acceptance tests pass for profile access, default denial, duplicate headers, cookie fallback prevention, invalidation and quota headers. All 96 unit tests, API lint/typecheck/build pass. A guard test covers bearer mutation behavior and continued CSRF requirements for sessions. OpenAPI and client regenerated.
Security: no dependency added. Quota responses share one helper; bearer principals contain no raw token or password hash. Tenant resource resolution remains M2.3; the current opt-in supports account-level access only. Stacked on #60; no merge requested.