Skip to content

[M2.2c4b] Expose audited account and session endpoints - #49

Merged
samuelmbabhazi merged 3 commits into
mainfrom
feat/m2.2c4b-auth-http
Nov 5, 2026
Merged

samuelmbabhazi merged 3 commits into
mainfrom
feat/m2.2c4b-auth-http

Conversation

@samuelmbabhazi

Copy link
Copy Markdown
Collaborator

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.

  • M2.2c4b acceptance criteria met
  • New HTTP behavior tested against real PostgreSQL and local TLS SMTP
  • State changes audited atomically by existing commands
  • Generated contract, spec, plan and example configuration updated
  • No new shell invocation or secret exposure path

@samuelmbabhazi
samuelmbabhazi force-pushed the feat/m2.2c4a-http-session-guards branch from 305870b to 0284c73 Compare November 5, 2026 12:16
@samuelmbabhazi
samuelmbabhazi changed the base branch from feat/m2.2c4a-http-session-guards to main November 5, 2026 12:16
@samuelmbabhazi
samuelmbabhazi merged commit 1c9a1fe into main Nov 5, 2026
9 checks passed
@samuelmbabhazi
samuelmbabhazi deleted the feat/m2.2c4b-auth-http branch November 5, 2026 12:17
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
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