Skip to content

idp-provider: account session + pending-claim approval surface + rate limits (#16655) - #16677

Merged
developing-today-fleet[bot] merged 2 commits into
mainfrom
felix/16655-account-session
Nov 29, 2026
Merged

developing-today-fleet[bot] merged 2 commits into
mainfrom
felix/16655-account-session

Conversation

@developing-today-fleet

@developing-today-fleet developing-today-fleet Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Refs #16655 (remainder of #13972; unblocks #13973). Lands unmerged for Felix's review.

What

Session layer (src/session.rs): completing a door login with an active identity — 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 /account on 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 method IdentityStore::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 actor established-session) plus an audit record (account/approve|reject, claim_approved|claim_rejected).
  • No/unknown/expired session → 401, audited (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 + audit rate_limited when tripped. Session establishment: 10/min per identity.

Verification

Remote, via fleet-command (developing-today/fleet):

  • Run 46242329033 — failed: one compile error in the new test file only (Signature::from_bytes; library compiled). Fixed in 22c07dc.
  • Run 46242891829 — success: cd pkgs/idp-provider && cargo test full suite, 61 passed / 0 failed across all binaries: tests/account.rs 7/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-bot with what you need.

Felix added 2 commits November 29, 2026 08:22
…+ 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.
@coderabbitai

coderabbitai Bot commented Nov 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: db7e22e2-43f1-4958-addb-9530a105ee93

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@developing-today-fleet

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants