Skip to content

[M2.2d4c2b] Expose secure API token management endpoints - #62

Merged
samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2d4c2b-token-management-http
Nov 5, 2026
Merged

samuelmbabhazi merged 1 commit into
mainfrom
feat/m2.2d4c2b-token-management-http

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

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.

  • M2.2d4c2b criteria met
  • Entire integration suite and affected package checks pass
  • Generated contract and plan/spec current
  • Credential issuance/revocation audited atomically

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2d4c2a-bearer-http branch from 6e186d8 to a189de2 Compare November 5, 2026 12:36
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.2d4c2a-bearer-http to main November 5, 2026 12:36
@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2d4c2b-token-management-http branch from e067c3c to df1810d Compare November 5, 2026 12:36
@samuelmbabhazi
samuelmbabhazi merged commit 1f2fb90 into main Nov 5, 2026
9 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.2d4c2b-token-management-http branch November 5, 2026 12:37
samuelmbabhazi added a commit that referenced this pull request Nov 5, 2026
The first typed web consumer exposed two contract defects: token-list
`limit` was generated as an object, and openapi-fetch's
Readable/Writable helpers transformed readonly arrays into objects whose
array methods were unusable. This blocked recovery-code and scope
handling under strict TypeScript.

The pagination DTO now explicitly declares an integer schema. A
version-pinned pnpm patch corrects only the helper package's three
TypeScript declaration entry points, using homomorphic array mapping to
preserve mutable/readonly arrays and tuples. Runtime JavaScript is
unchanged, and no dependency version is downgraded. This addresses the
confirmed upstream issue:
openapi-ts/openapi-typescript#2615. Remove the
patch after an upstream fix passes these regressions.

Validation: the new client typecheck failed before the fixes. API and
client lint/typecheck/tests now pass (96 API tests, four client tests),
API production build passes, and OpenAPI/client regeneration is current.
Regression tests exercise numeric pagination, nested readonly response
scopes and readonly request bodies; the HTTP OpenAPI test asserts the
integer schema.

Security: no authentication semantics or runtime dependency code
changes; no casts weakening the generated contract. Stacked on #62; no
merge requested.

- [x] M2.2e1a criteria met
- [x] Compile-time and runtime regressions covered
- [x] Generated artifacts current
- [x] Temporary patch reason and removal condition documented
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