Repository navigation
Description
Tracking issue for wiring the account_id act-on-behalf override into the 7 endpoints the chat#1974 audit classified as unwired-candidates, plus the DRY helper that keeps the class closed. Follow-up to chat#1974 (both confirmed prod instances fixed there: api#845, api#846); filed as one batch tracker rather than seven micro-issues because the candidates share one pattern, one fix shape, and one shared helper.
Goal
An org key or RECOUP admin that can already list a member account's resources can also read/mutate the specific resources internal tooling needs, through the same centrally-authorized validateAuthContext(request, { accountId }) path — and new endpoints can't silently ignore an account_id param again.
Explicitly rejected (audit finding, 2026-08-21): central auto-read of ?account_id= inside validateAuthContext. account_id is not always an override — DELETE /api/organizations/members (member being removed), POST /api/organizations/members (member being added), and GET /api/artists (filter) give it other meanings; a blanket auto-read would turn the org-members routes into a privilege-escalation path. Per-endpoint threading through a shared fragment stays the design.
PRs
| PR | Item | State |
|---|---|---|
| api#TBD | Shared accountIdOverrideParam zod fragment + helper (one-line wiring for GETs, identical semantics) + a validators-directory convention test: any schema containing an override-intent account_id must thread it to validateAuthContext |
⏳ not started |
| api#TBD | Wire the 4 fix-now endpoints through the fragment: GET /api/runs, DELETE /api/tasks, GET /api/catalogs/songs, GET /api/sandboxes/file (TDD per endpoint; docs rows in the same cycle) |
⏳ not started |
| docs#TBD | Document account_id on the 4 wired ops |
⏳ not started |
Merge sequencing: docs → api (contract first). The docs PR can cover all four ops in one page-set change.
Open — in priority order
-
GET /api/runs— asymmetric withPOST /api/valuationsince api#846: a run started for a member account can't be polled by the operator who started it. Done when: admin/org caller with?account_id=sees the member's runs; non-privileged foreignaccount_id→ 403; no-param unchanged. -
DELETE /api/tasks— read side honorsaccount_id, delete 403s; blocks the zombie-task sweeps (gap known since 2026-07). Done when: admin can delete a member's task by id with bodyaccount_id; rejection + no-param cases pinned. -
GET /api/catalogs/songs—authorizeCatalogAccessexpands only the caller's own orgs; admin acting for a member 403s (the exact chat#1974 class). Done when: override read returns the member catalog's songs; rejection pinned. -
GET /api/sandboxes/file—buildGetSandboxesParamsalready supportstarget_account_id; siblingGET /api/sandboxesis wired. One-line inconsistency. Done when: file read works with?account_id=exactly like the list op. - Shared fragment + convention test (lands with the first api PR). Done when: the four endpoints above use it, and the test fails on any validator that declares an override-style
account_idwithout threading it. - Conditional (wire only when the need materializes; re-classify then):
POST /api/research/measurement-jobs(admin backfills currently bill the operator),POST /api/sandboxes/files(write into a member repo),POST /api/research/snapshots(legacy, superseded — confirm it still has callers before touching).
Source references
- The audit: classification comment on chat#1974 (counts: 14 wired / ~54 not-applicable / 7 candidates over 98 call sites at api
ac145227). - Reference implementations: api#845 (query-param override,
GET .../measurements), api#846 (body override with effective-account side-effect scoping,POST /api/valuation). - Authorization core:
validateAccountIdOverride→canAccessAccount(RECOUP_ORG universal branch + shared-org branch), verified live on both branches 2026-08-20 (403→404 differential on api#845).
Activity
sidneyswift commentedon Nov 6, 2026
GET /api/sandboxes/filenow acceptsaccount_idthrough the shared access policy (recoupable/api#1131).Left:
GET /api/runs,DELETE /api/tasksandGET /api/catalogs/songsstill ignore an override. The shared fragment and convention test haven't been built.