Skip to content

[M2.2d4c2a] Enforce opt-in Bearer access and HTTP quotas - #61

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2d4c2a-bearer-http
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2d4c2a-bearer-http

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

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.

  • M2.2d4c2a acceptance met
  • HTTP/database and guard tests pass
  • Generated contract current
  • Default-deny behavior and secret boundaries covered

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2d4c1-api-token-auth branch from 116e039 to 5fb43ba Compare November 5, 2026 12:35
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.2d4c1-api-token-auth to main November 5, 2026 12:35
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2d4c2a-bearer-http branch from 6e186d8 to a189de2 Compare November 5, 2026 12:36
@samuelmbabhazi
samuelmbabhazi merged commit 46aa450 into main Nov 5, 2026
9 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.2d4c2a-bearer-http branch November 5, 2026 12:36
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant