Skip to content

fix: stop sending orgId on file and token calls - #1

Merged
kayvink merged 4 commits into
mainfrom
fix/drop-orgid-from-file-api
Aug 5, 2026
Merged

fix: stop sending orgId on file and token calls#1
kayvink merged 4 commits into
mainfrom
fix/drop-orgid-from-file-api

Conversation

@kayvink

@kayvink kayvink commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Follow-up to the S0 membership guard in buron (kayvink/buron#201).

The server now derives the organization from the Team row and verifies the caller's membership, so orgId in the request body is ignored. Sending it was never authorization — before the guard landed, it was the value the server trusted, which is exactly what made a spoofed orgId a cross-tenant read.

Changes

  • api.files.* (read/write/append/list/glob/grep/delete/move/replace): orgId parameter and body field removed; teamId alone identifies the target
  • generateToken: same, and /api/v1/tokens now scopes the minted key to the org it derives from the team
  • Call sites in src/commands/file.ts updated

Not touched

data.* (datasets, warehouse SQL) still send orgId. Those endpoints don't exist in the server yet, so their payload contract is undecided — worth revisiting when the semantic-datasets work lands.

Compatibility

No behaviour change against a current server. Older servers also still work, since they read the org from the session before falling back to the body.

Typecheck and build clean.

🤖 Generated with Claude Code

kayvink added 4 commits May 26, 2026 18:14
Replace ad-hoc GAQL/SQL with pick-based querying against the app's semantic
datasets:
- buron datasets list|describe|query (-m/-d/-f field:op:value/--from/--to/
  --granularity/--sort/--limit/--spec)
- buron sql <select> — read-only warehouse escape hatch
- buron queries create --spec (structured SemanticQuery, replaces -s/-q raw
  strings); queries list --dataset; run returns the QueryResult envelope
- buron dashboards add <dashboardId> <queryId>
- --json everywhere for scripting
- DELETE buron query (raw GAQL) — targets the retired /api/v1/query
Types mirror the app's SemanticQuery contract; server validates. tsc 0, biome
clean, build green. Bumped to 0.3.0 (breaking).
The server now derives the organization from the Team row and verifies the
caller's membership (requireCliTeamAccess), so orgId in the request body is
ignored. Sending it was never authorization - before the guard landed it was
the value the server trusted, which is what made a spoofed orgId a
cross-tenant read.

Drops the parameter from api.files.* and generateToken plus their call sites;
teamId alone identifies the target now. No behaviour change against a current
server, and older servers still accept these payloads because they read
orgId from the session first.

Leaves data.* (datasets, warehouse SQL) untouched: those endpoints do not
exist server-side yet, so their payload contract is still undecided.
@kayvink
kayvink merged commit c190516 into main Aug 5, 2026
1 check passed
@kayvink
kayvink deleted the fix/drop-orgid-from-file-api branch August 5, 2026 16:22
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.

1 participant