Scope Fjord OIDC sessions and instances to named accounts (#157 step 2b-i) #309
Loading…
Reference in a new issue
No description provided.
Delete branch "fj-157-fjord-profiles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 2b-i of #157: Fjord gateway accounts become named profiles, so a command can run against a chosen Fjord account the same way step 2a does for PAT accounts. Browser shortcuts, mute and inbox filtering and the work and status instance display still read the legacy host and are step 2b-ii (with scoped session cookies and the remaining maintenance commands); until that lands, named Fjord profiles cover API and instance commands only, and docs/account-override.md says so. #157 stays open until both land.
The manual, loopback PKCE and device OIDC login flows share one named-session completion. The bearer and the identity-bound refresh token go into separate host/account/generation slots that are staged and read back before the descriptor is atomically published, and failed verification, storage or publication leaves the default and the legacy fields and keys untouched. Platform URL and credential storage identity stay separate. Client and direct instance commands resolve the same explicit or default profile with no legacy or cross-account fallback; instance metadata stays per profile;
fj auth switchverifies the stored identity, fences the platform destination and the verified host snapshot, and refreshes once on a 401 before moving the default. Refresh takes a hashed account-scoped cross-process lock with generation fencing, adopts a peer's newer bearer (and renews it if it has also expired), and persists a rotated refresh token before any further network work, so a timeout after a successful exchange never spends the grant. Status stays redacted and named OIDC failures suppress provider bodies.Offline tests: 22 unit tests and four CLI integration tests (device login, two accounts on one platform, one account on two platforms, explicit and default instance selection, missing-profile refusal, failed identity, storage and publication, redaction, two simultaneous clients hitting one initial 401 with exactly one refresh exchange, the publication race, rotation surviving a 503, and switching with an expired bearer). Live interactive browser login and CI coverage are still to be confirmed.
Automated Codex review (read-only) of head
67bbea3477.Medium
src/cli/instances.rs:249Invariant: Named OIDC failures must suppress provider bodies (standards 11 and 20). Both named
instances listandinstances usepropagate errors fromfetch_listing_once, including the retry at line 256. That helper callsfjord::list_instances, whose non-success errors include the response body. On a supported named profile, a platform 403 or 503 containing account diagnostics therefore exposes them through--debug. This newly enabled named entry point bypasses the sanitization used by login, switch, and refresh. Sanitize named listing errors on both attempts, preservingSessionExpiredfor refresh. Test provider-body suppression for list and use.Low
tests/fjord_profiles.rs:171Invariant: Tests must exercise the failure they claim to cover (standard 13). The “wrong” account login receives a token whose email matches that requested account. It fails because no instance-list mock accepts that token, producing 404. It never tests rejection of a platform-accepted bearer belonging to another account. Return an existing account’s accepted token while requesting a different account, then assert that publication and defaults remain unchanged.
BLOCKING: 1
Reviewed head
67bbea3477at 2026-11-10T18:15:13Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
cfa9e3e4c5.src/config/fjord_scope.rs:11: Invariant: named-profile failures must suppress provider bodies across every request path (standards 11 and 18). Bothinstances listandinstances usecallfetch_listing_once, which also fetches Commons. When/api/v1/me/commonsreturns a 403 or 503,fetch_commonsincludes the response body in its error, andsettle_commonsprints that error under--debugbefore this wrapper can redact it. A normal Commons outage can therefore expose private provider diagnostics in terminal output or captured logs, including after a refresh. This belongs in this PR because named-session error redaction is explicitly promised. Pass the profile redaction policy into the Commons settlement path and suppress bodies before logging. Extendfjord_profile_listing_errors.rsto fail the Commons endpoint as well as the instance endpoint, for both commands before and after refresh.BLOCKING: 1
Reviewed head
cfa9e3e4c5at 2026-11-10T18:42:53Z by codex exec (read-only sandbox).Automated Codex review (read-only) of head
f8f4a26ef3.No confirmed correctness, security, or failure-path findings in the diff against STANDARDS.md. The documented step 2b-ii deferrals remain unchanged. Reviewed surrounding code; no tests run in the read-only sandbox.
BLOCKING: 0
Reviewed head
f8f4a26ef3at 2026-11-10T18:58:32Z by codex exec (read-only sandbox).