Commit Graph
2 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 223a2f0915 fix(github): the org token is for accounts entitled to fleet infrastructure, not every session (#651)
The org write token added in #634 was handed to any signed-in account. It can
create, seed and DELETE repositories in the bitbaum organisation — a
server-held admin credential reachable by whoever holds a session is a
privilege escalation waiting for the first external user, and FleetCrown is
schema-ready for those today.

It is now offered only to accounts already entitled to fleet-owned
infrastructure — founder or explicit allowlist, the same boundary the shared
cloud builder draws (docs/architecture/multitenancy-execution-plan.md). Anyone
else writes with their own GitHub token exactly as before, and if their org
refuses it they get the honest 403 that names both remedies.

`isFleetInfrastructureAllowed` is separate from `getExecutionAccess` on
purpose: that one also reads runner presence, which a GitHub write has no use
for, and "may this account act as the fleet" deserves one name every caller
asks by rather than each re-deriving `isDefault || allowlist`.

Verified: tsc, eslint, scripts/test/github-org-token.ts (extended to pin that
an unentitled account falls back to its own token, never the org's).


Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 06:43:21 -07:00
CatoandClaude Fable 5.1 a8a36de68b fix(kickoff): org repos are created with a server-held org token, not the person's OAuth grant (#634)
"Creating the repository" failed for every kickoff on 2026-09-11 with HTTP 403:
the bitbaum organisation restricts OAuth apps, and FleetCrown's app is not
approved there — so the person's OAuth token cannot create in the org, and the
route offered no other way in. Meanwhile the box's own site factory creates
repos in the same org every day, with an org admin's token.

Org writes — create, seed the starter, wire CD (the workflow shim), archive or
delete — now use `GITHUB_ORG_TOKEN` when the server has one, and the person's
token only as the fallback (`src/lib/github-org-token.ts`, one rule, tested).
Identity-scoped reads (the person's repo list, who they are) keep the person's
token. The 403 message names both remedies.

Verified: tsc, eslint, scripts/test/github-org-token.ts.


Claude-Session: https://claude.ai/code/session_01WSNERoZZqW2TgqbAGHSQZf

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-11 04:00:35 -07:00