fix(sandbox-control): read the orgRole claim that Orca Cloud auth mints (#29)

Auth mints the live org role as orgRole on sandbox tokens (same claim as billing
tokens, stablyai/orca-cloud#695); the verifier read org_role, so admins would
never have been recognized.
This commit is contained in:
Neil
2026-11-09 04:30:17 -08:00
committed by Neil
parent 3de9ec3673
commit 7bbe80aefd
3 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ const ClaimsSchema = z.object({
sub: ID,
org: ID.optional(),
/** The caller's role in `org`, minted by Orca Cloud auth; absent means no admin rights. */
org_role: z.enum(['owner', 'admin', 'member']).optional(),
orgRole: z.enum(['owner', 'admin', 'member']).optional(),
purpose: z.literal('sandbox')
})
@@ -81,7 +81,7 @@ async function verify(
return {
userId: claims.sub,
accountId: accountIdFor(claims),
...(claims.org ? { orgId: claims.org, ...(claims.org_role ? { orgRole: claims.org_role } : {}) } : {})
...(claims.org ? { orgId: claims.org, ...(claims.orgRole ? { orgRole: claims.orgRole } : {}) } : {})
}
} catch {
return null
@@ -34,7 +34,7 @@ afterEach(() => {
async function setup(overrides: Record<string, string> = {}, deps: Parameters<typeof createHarness>[1] = {}) {
const h = await createHarness({ SECRETS_KEK: KEK, ...overrides }, deps)
const as = async (sub: string, org?: string, role?: string) =>
h.token(sub, org, 'sandbox', role ? { org_role: role } : {})
h.token(sub, org, 'sandbox', role ? { orgRole: role } : {})
async function put(scope: string, name: string, value: string, bearer: string, repo?: string) {
const query = repo ? `?repo=${encodeURIComponent(repo)}` : ''
return h.call('PUT', `/v1/secrets/${scope}/${name}${query}`, { body: { value }, bearer })
+2 -2
View File
@@ -215,7 +215,7 @@ Product decision: "API-key injection" in the Conductor parity matrix (form 2 = t
- **API** (desktop JWT): `GET /v1/secrets?scope=org|personal|repo[&repo=owner/name]`, `PUT /v1/secrets/:scope/:NAME`
`{value}`, `DELETE …`. Write-only values: responses carry name, scope, kind, updatedAt, updatedBy and a last-4 hint
for values ≥16 chars. Owners: org = the org account (`org:<id>`), personal = `user:<sub>`, repo =
`<account>#github.com/<owner>/<repo>`. Org secrets and an org account's repo secrets need `org_role` owner/admin on
`<account>#github.com/<owner>/<repo>`. Org secrets and an org account's repo secrets need `orgRole` owner/admin on
the token (any member lists names); personal secrets are the user's alone; dev tokens stay under `dev:`.
- **Validation**: `^[A-Z_][A-Z0-9_]*$` ≤128; reserved names (PATH, HOME, NODE_OPTIONS, proxy/CA vars, GIT_SSH*,
GH_TOKEN/GITHUB_TOKEN, …) and prefixes (LD_, DYLD_, ORCA_, VERCEL_, BASH_FUNC_, GIT_CONFIG). Values ≤8 KiB, no NUL;
@@ -237,7 +237,7 @@ Product decision: "API-key injection" in the Conductor parity matrix (form 2 = t
because (1) SSE model streams through Vercel forwardURL → Worker are not yet tested live, and (2) with a key routed,
api.anthropic.com denies everything else, including a subscription OAuth Bearer or a plain `ANTHROPIC_AUTH_TOKEN`
in the same VM. Enable on dev after a live streaming test with the rebuilt image.
- Needs: golden image rebuild (new `orca-sandbox-start`), and Orca Cloud auth minting `org_role` on sandbox tokens.
- Needs: golden image rebuild (new `orca-sandbox-start`), and Orca Cloud auth minting `orgRole` on sandbox tokens (stablyai/orca-cloud#695).
## GitHub installation binding, guardrails, retention (2026-11-09)