Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ void github join
void github connect --executor container
```

Organization installations always require a browser proof for the specific repository, including for the person who installed the App. Void does not reveal the installation's full private repository list. If an upgraded platform marks an older organization connection as requiring reconnection, run the same `void github connect` command again to renew that repository-scoped authorization before builds resume.
Organization installations always require a browser proof for the specific repository, including for the person who installed the App. Void does not reveal the installation's full private repository list.

4. Verify the connection

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1400,7 +1400,7 @@ void github connect my-app \

For every organization installation, `void github connect` confirms that you personally have access to the specific repository, including when you originally installed the App. Interactively (TTY), it opens your browser once to authorize access to that repo on GitHub (a localhost + PKCE handshake), then completes the connection automatically. Without a TTY, this per-repo authorization never opens a browser: connect fails closed with an error explaining that the installation requires per-repo authorization and telling you to run `void github connect` locally. Interactively, connect joins the shared installation automatically when your account has no active installations linked, so running `void github join` first is optional. You can only connect repositories you can access on GitHub; seeing the organization installation never grants access to its other private repositories.

After upgrading from a platform version that treated an organization installer as an owner, existing organization connections show **Reconnect required** and stop starting builds until their repository access is proven. Run `void github connect <project> --repo <owner/repo>` again. The command reauthorizes the same connection in place after the browser proof; if the repository or installation changed, disconnect it first and connect the intended repository.
A project has one GitHub connection. Running `void github connect` on a project that is already connected fails. To connect a different repository, run `void github disconnect` first.

### `void github update`

Expand Down Expand Up @@ -1433,7 +1433,7 @@ void github update my-app --executor github_actions
void github status [project]
```

Show a project's current GitHub connection: the connected **repository**, the deploy **branch**, the **build executor** (`container` or `github_actions`), and the authorized **deploy workflow file**. Read-only — it never changes anything. The workflow file is the OIDC pin used only for `github_actions` builds; on a `container` connection it is still shown but marked unused. Legacy organization connections also show **Reconnect required** until `void github connect` proves current access to that repository. The project must already be connected (run `void github connect` first, otherwise it reports that and exits).
Show a project's current GitHub connection: the connected **repository**, the deploy **branch**, the **build executor** (`container` or `github_actions`), and the authorized **deploy workflow file**. Read-only — it never changes anything. The workflow file is the OIDC pin used only for `github_actions` builds; on a `container` connection it is still shown but marked unused. The project must already be connected (run `void github connect` first, otherwise it reports that and exits).

**Options**

Expand Down
1 change: 0 additions & 1 deletion packages/void/src/cli/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ export type GithubConnection = {
branch: string;
build_executor: 'container' | 'github_actions';
workflow_path: string;
requires_reconnect?: boolean;
created_at: string;
updated_at: string;
};
Expand Down
5 changes: 0 additions & 5 deletions packages/void/src/cli/github-cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,6 @@ export function formatConnection(connection: GithubConnection): string {
row('Build executor', connection.build_executor),
row('Deploy workflow', workflow),
];
if (connection.requires_reconnect) {
rows.push(
row('Authorization', 'Reconnect required: run `void github connect` for this repository'),
);
}
return rows.join('\n');
}

Expand Down
6 changes: 0 additions & 6 deletions packages/void/test/unit/github-cmd.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,6 @@ describe('formatConnection', () => {
expect(out).toContain('Build executor');
expect(out).toContain('Deploy workflow');
});

it('shows the organization reconnect action when authorization is unproven', () => {
const out = formatConnection(makeConnection({ requires_reconnect: true }));
expect(out).toContain('Reconnect required');
expect(out).toContain('void github connect');
});
});

describe('parseGithubRepoFullName', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,8 @@ installed the App, requires a separate browser proof that the connecting GitHub
user can access that specific repository. The signed connect grant carries the
repository's immutable GitHub ID and is redeemed under the connecting user's
Void identity. The platform records the authorizing Void user on the project
connection. A legacy organization connection without that proof must be
reconnected before builds resume. Personal installations retain their
installation-owner path.
connection. Organization installations have no owner. Personal installations
retain their installation-owner path.

An installation membership permits a user to see and select an organization
installation; it does not disclose the installation's private repository list
Expand All @@ -71,7 +70,7 @@ when a repository is connected.
## Revocation and missed webhooks

On `organization/member_removed`, the platform deletes the affected membership,
clears applicable legacy owner access, severs affected repository connections,
severs the repository connections that member authorized,
and cancels their active builds. A durable revocation mark keyed by the GitHub
account and installation rejects join or connect artifacts minted before the
removal, including artifacts created before a Void account was linked. The
Expand Down
65 changes: 65 additions & 0 deletions platform/packages/api/drizzle/0052_github_connection_authority.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
UPDATE "github_installations"
SET "user_id" = NULL
WHERE "account_type" = 'Organization' AND "user_id" IS NOT NULL;
--> statement-breakpoint
UPDATE "github_connections"
SET "authorized_by_user_id" = "projects"."user_id"
FROM "projects", "github_installations"
WHERE
"github_connections"."authorized_by_user_id" IS NULL
AND "projects"."id" = "github_connections"."project_id"
AND "github_installations"."installation_id" = "github_connections"."installation_id"
AND "github_installations"."account_type" = 'User'
AND "github_installations"."user_id" = "projects"."user_id";
--> statement-breakpoint
UPDATE "builds"
SET
"status" = 'cancelled',
Comment thread
Brooooooklyn marked this conversation as resolved.
Resolved
"error" = COALESCE("builds"."error", 'github repository authorization is no longer valid; reconnect the repository'),
"completed_at" = COALESCE("builds"."completed_at", now())
FROM "github_connections", "projects"
WHERE
"github_connections"."project_id" = "builds"."project_id"
AND "projects"."id" = "github_connections"."project_id"
AND (
"github_connections"."authorized_by_user_id" IS NULL
OR "github_connections"."repository_id" IS NULL
OR NOT (
"github_connections"."authorized_by_user_id" = "projects"."user_id"
OR EXISTS (
SELECT 1
FROM "project_members"
WHERE
"project_members"."project_id" = "projects"."id"
AND "project_members"."user_id" = "github_connections"."authorized_by_user_id"
AND "project_members"."role" = 'admin'
)
)
)
AND "builds"."status" IN ('queued', 'starting', 'building', 'deploying');
--> statement-breakpoint
DELETE FROM "github_connections"
USING "projects"
WHERE
"projects"."id" = "github_connections"."project_id"
AND (
"github_connections"."authorized_by_user_id" IS NULL
OR "github_connections"."repository_id" IS NULL
OR NOT (
"github_connections"."authorized_by_user_id" = "projects"."user_id"
OR EXISTS (
SELECT 1
FROM "project_members"
WHERE
"project_members"."project_id" = "projects"."id"
AND "project_members"."user_id" = "github_connections"."authorized_by_user_id"
AND "project_members"."role" = 'admin'
)
)
);
--> statement-breakpoint
DELETE FROM "github_installation_members"
USING "github_installations"
WHERE
"github_installations"."installation_id" = "github_installation_members"."installation_id"
AND "github_installations"."account_type" = 'User';
4 changes: 4 additions & 0 deletions platform/packages/api/drizzle/compatibility.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
{
"platformVersion": "0.21.2",
"schemaDigest": "9a9ae6677b795debd4ffaa20a05f533727063c7a21366310a2fe4b17bd918edd"
},
{
"platformVersion": "0.21.9",
"schemaDigest": "ac70deb5847c71ece9938edd27e5dbc50ce41e16771926c78e757850baf15bfa"
}
]
}
7 changes: 7 additions & 0 deletions platform/packages/api/drizzle/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,13 @@
"when": 1790721898182,
"tag": "0051_icy_psylocke",
"breakpoints": true
},
{
"idx": 52,
"version": "7",
"when": 1790827715142,
"tag": "0052_github_connection_authority",
"breakpoints": true
}
]
}
36 changes: 17 additions & 19 deletions platform/packages/api/src/build-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1522,18 +1522,21 @@ export class BuildManager extends Container<ApiEnv['Bindings']> {
// the enqueue-time check is stale. A fresh plain (non-locking) Postgres
// read here observes the committed revocation and fails closed before we
// mint a live deploy token, rather than relying solely on the installation
// token mint failing once its ~55-min cache expires. A null repositoryId
// (unprovable membership) fails closed by construction. Treat an
// token mint failing once its ~55-min cache expires. A missing connection
// or repository id fails closed. Treat an
// uncovered build like the non-identical freshness branch: cancel (not a
// build failure), don't mint or start. Nothing is started yet, so there is
// no container to tear down.
const covered = await installationCoversRepo(
this.db(),
config.connectionId,
config.projectId,
config.installationId,
config.repositoryId,
);
const repositoryId = config.repositoryId;
const covered =
repositoryId !== null &&
(await installationCoversRepo(
this.db(),
config.connectionId,
config.projectId,
config.installationId,
repositoryId,
));
if (!covered) {
const won = await markBuildTerminalIfActive(this.db(), config.buildId, 'cancelled', {
error: 'github repository authorization is no longer valid; reconnect the repository',
Expand Down Expand Up @@ -1711,16 +1714,11 @@ export class BuildManager extends Container<ApiEnv['Bindings']> {
// but it's injected into the container env where an untrusted dependency
// `postinstall` could read it — a repo-scoped `{ contents: 'read' }` token
// caps that blast radius to this single repo instead of every repo the
// install covers. A null repositoryId (legacy/partial connection) can't be
// scoped, so fall back to the unscoped installation-wide mint to preserve
// compatibility; coverage is already re-verified above.
const sourceToken =
config.repositoryId !== null
? await getInstallationToken(this.env, config.installationId, {
repositoryIds: [config.repositoryId],
permissions: { contents: 'read' },
})
: await getInstallationToken(this.env, config.installationId);
// install covers.
const sourceToken = await getInstallationToken(this.env, config.installationId, {
repositoryIds: [repositoryId],
permissions: { contents: 'read' },
});
// The installation-token fetch is the longest pre-launch await and was the
// original orphan window: cancellation observed no live container, returned,
// and this continuation launched afterward. The generation fence closes it.
Expand Down
4 changes: 2 additions & 2 deletions platform/packages/api/src/build-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class BuildScheduler extends DurableObject<ApiEnv['Bindings']> {
}
if (!(await hasGitHubConnectionAuthority(db, connection.id, build.project_id))) {
await updateBuildStatus(db, build.id, 'cancelled', {
error: 'github organization repository must be reconnected to renew authorization',
error: 'github repository authorization is no longer valid; reconnect the repository',
completedAt: new Date().toISOString(),
});
continue;
Expand Down Expand Up @@ -242,7 +242,7 @@ export class BuildScheduler extends DurableObject<ApiEnv['Bindings']> {
// project (resolved above by the UNIQUE project_id) is the source of
// truth — mirrors webhooks.ts / auth-oidc.ts. startBuild re-verifies the
// App installation still covers this repo before minting the deploy
// token; a null id fails that check closed.
// token; a missing id fails that check closed.
repositoryId: connection.repository_id,
instanceType,
timeoutMinutes: getPlanLimits(claimed.ownerPlan).buildTimeoutMinutes,
Expand Down
17 changes: 8 additions & 9 deletions platform/packages/api/src/build-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ export type BuildConfig = {
repoFullName: string;
installationId: string;
/**
* Exact connection row authorized at enqueue. Older persisted manager state
* may omit it; the final authority check treats that as unproven and cancels.
* Exact connection row authorized at enqueue. The final authority check
* cancels the build when it is missing.
*/
connectionId?: string;
connectionId: string;
/**
* The connection's immutable numeric GitHub repository id (as text), or null
* for a legacy/partial connection that never populated it. Carried so
* `BuildManager.startBuild` can re-verify the App installation still covers
* this repo at token-mint time (a null id fails that check closed). Sourced
* from the github connection bound to this build (the build row itself does
* not store a repository id).
* The connection's immutable numeric GitHub repository id (as text). Carried
* so `BuildManager.startBuild` can re-verify the App installation still
* covers this repo at token-mint time; a missing id fails that check closed.
* Sourced from the github connection bound to this build (the build row
* itself does not store a repository id).
*/
repositoryId: string | null;
instanceType: string;
Expand Down
Loading
Loading