Repository navigation
[M2.2c4b] Expose audited account and session endpoints - #49
Merged
Merged
Conversation
4 tasks done
samuelmbabhazi
force-pushed
the
feat/m2.2c4a-http-session-guards
branch
from
November 5, 2026 12:16
305870b to
0284c73
Compare
samuelmbabhazi
changed the base branch from
feat/m2.2c4a-http-session-guards
to
main
November 5, 2026 12:16
samuelmbabhazi
force-pushed
the
feat/m2.2c4b-auth-http
branch
from
November 5, 2026 12:16
66a0f74 to
d7e4460
Compare
samuelmbabhazi
added a commit
that referenced
this pull request
Nov 5, 2026
Authentication retries now have a durable encrypted request/response store. A transaction-scoped PostgreSQL advisory lock serializes each route/key across API instances; the command, its audit and the cached response commit or roll back together. Reusing a key for another request returns a conflict. Keys are lowercase UUIDv4/v7 values; rows contain only a purpose-bound key hash and envelope ciphertext, with a five-minute lifetime enforced by SQL. Both request credentials and response cookies are encrypted, avoiding a low-cost persisted password-verification hash. Comparisons use fixed-length constant-time hashes in memory. Expired rows are cleaned in batches of at most 100. Validation: API lint/typecheck and all 45 real PostgreSQL/TLS SMTP integration tests pass. Four new tests cover concurrent instances, route/request binding, exact expiry, encrypted storage, command/audit rollback on write failure, corruption and invalid keys. HTTP integration follows in M2.2c4c2. Security: this explicitly documented five-minute encrypted snapshot is the exception to hash-only long-lived credential persistence; a replay result is not an authentication authority. Unknown storage/crypto errors are opaque. No external transport runs in the transaction and no new business mutation bypasses audit. Stacked on #49; no merge requested. - [x] M2.2c4c1 criteria met and plan updated - [x] Schema migration tested on real PostgreSQL - [x] Concurrency and failure recovery covered - [x] No plaintext credentials, new shell invocation or generated-code edits
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 account/session commands are now reachable through eight validated HTTP endpoints: signup, verification request/claim, password-reset request/claim, login, session lookup and logout. The identity module registers default-deny authentication and persistent rate guards globally; health remains explicitly public.
Login returns only account metadata and sets the session/CSRF cookies. Signup and mail requests return the same empty 202 for existing/missing accounts. Missing SMTP configuration rejects mail-dependent commands before account creation. The durable email worker starts after the queue and only when SMTP is configured. Responses are no-store, bodies are capped at 16 KiB, and proxy trust defaults to none (explicit loopback option).
Validation: all 41 PostgreSQL/TLS SMTP integration tests pass, including a full HTTP signup → email delivery → verification → session rotation → password reset → logout flow. Additional HTTP checks exercise duplicate/replayed codes, missing CSRF, generic account responses, quota headers, oversized/unknown fields, audit rollback and missing SMTP. Workspace TS lint/typechecks/tests, API production build, Go tests and protobuf lint pass. OpenAPI and the typed client were regenerated.
Security: no credential in response JSON or navigation URLs; auth failures do not expose account existence. Protected routes require session/CSRF; credentials are wrapped at the boundary. The idempotency header is tracked separately in M2.2c4c, MFA/tokens in M2.2d and the browser UI in M2.2e. This PR is stacked on #48; no merge requested.