Repository navigation
idp-provider: account session + pending-claim approval surface + rate limits (#16655) - #16677
Conversation
…+ rate limits (#16655) Completes the remainder of #13972: completing a door login with an active identity now establishes a short-lived, account-bound account-management session (cookie scoped to /account, 10 min TTL, establishment rate-limited per identity). From that session the holder can list pending claims against their account and approve or reject each (POST /account/pending/approve|reject, GET /account/pending); dispositions are written to the identity history by the store (actor established-session) and to the audit record. The account surface is rate-limited per account (30/min) before any store work; no-session attempts deny with 401 and are audited; another account's claims read as not found. New modules: session.rs (session store + cookie), ratelimit.rs (fixed-window limiter), account.rs (the surface). Identity store gains pending_for_account. Tests: tests/account.rs drives the policy flow end to end over HTTP against a mock Google upstream (approve then full sign-in; reject then door stays shut), plus no-session, cross-account, and both rate limits.
|
Important Review skippedBot user detected. To trigger a single review, invoke the
|
|
Lane 0252-C (bravo SUSTAIN landings) — merging on full-diff verification. Diff read in full (8 files, +1335/-2): session.rs (10-min account-bound sessions, HttpOnly cookie scoped to /account, fail-closed store), ratelimit.rs (fixed-window, fail-closed on poisoned lock, unit-tested), account.rs (session required → audited 401; per-account rate limit before store work; cross-account claims read as 404; approve/reject via existing store transitions with history + audit), identities.rs pending_for_account query, flow.rs/doors.rs session establishment on both doors without touching the authorization-code flow, lib.rs routes, and tests/account.rs (7 end-to-end tests over HTTP against a mock Google upstream). Matches #16655's acceptance mapping; the PR's recorded remote run 46242891829 shows the full suite green (61 passed) at this head. CI is not a gate per Drew's 2026-11-29 rule; post-merge failures get fixed forward. |
Refs #16655 (remainder of #13972; unblocks #13973). Lands unmerged for Felix's review.
What
Session layer (
src/session.rs): completing a door login with anactiveidentity — local door (flow.rs) or federated door (doors.rs) — now also establishes a short-lived (10 min), account-bound account-management session, returned as an HttpOnly cookie scoped to/accounton the login's redirect response. The authorization-code flow itself is unchanged; when session establishment is rate-limited the login still succeeds, just without a new cookie.Approval surface (
src/account.rs):GET /account/pending— lists pending claims against the session's account (new store methodIdentityStore::pending_for_account).POST /account/pending/approve/POST /account/pending/reject— dispose of a claim through the store's existing transitions (identity history event with actorestablished-session) plus an audit record (account/approve|reject,claim_approved|claim_rejected).account / denied / no_session). A claim that is not pending against the session's own account reads as 404 — no cross-account visibility.Rate limits (
src/ratelimit.rs): fixed-window limiter. Account surface: 30 attempts/min per account, checked after session resolution and before any store work (denied attempts consume budget), 429 + auditrate_limitedwhen tripped. Session establishment: 10/min per identity.Verification
Remote, via fleet-command (developing-today/fleet):
Signature::from_bytes; library compiled). Fixed in 22c07dc.cd pkgs/idp-provider && cargo testfull suite, 61 passed / 0 failed across all binaries:tests/account.rs7/7 (policy flow end-to-end over HTTP against a mock Google upstream: approve → claimed identity signs in fully with token sub = account; reject → door stays shut; no-session denials audited; cross-account invisibility; both rate limits), lib unittests 25 (incl. new session/ratelimit unit tests), doors 16, endpoints/flow/consumer/rollover all green — existing door behaviour preserved.Acceptance mapping (#16655): session via already-active identity ✓ (local + Google door, tested); approve → active + both providers sign in ✓; reject → no tokens ✓; history + audit for both ✓; no-session denials ✓; rate limits with test ✓; existing suite green ✓.
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-29T08:55:12Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch", "repo": "developing-today/code", "branch": "main", "sha": "ac3f377b7f752f50918f491d7443b79e95b5dc34" }, "auth_subject": "felix", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.