From 43ffc52fc1981463e7f30665db5a97710b562c14 Mon Sep 17 00:00:00 2001 From: Erik Goins Date: Thu, 19 Nov 2026 14:05:23 -0500 Subject: [PATCH] fix: drop email_addresses from the GitHub App manifest; GitHub rejects it Creating the App failed on GitHub with "Default permission records resource is not included in the list". Probing the manifest endpoint showed email_addresses (an account permission) is the key GitHub refuses; without it the manifest is accepted. The admin adds Email addresses: Read in the App settings after creation, documented in the self-host guide. The setup test now fails if the manifest names an account permission. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01T7sHyaEvdoSPjkLy7T1aaz Signed-off-by: Erik Goins --- docs/features/github-app.md | 3 +++ docs/self-host/README.md | 3 +++ packages/server/src/github/setup.ts | 5 +++-- packages/server/test/setup.test.ts | 8 ++++++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/features/github-app.md b/docs/features/github-app.md index d2fc8e6..52efad8 100644 --- a/docs/features/github-app.md +++ b/docs/features/github-app.md @@ -114,6 +114,9 @@ them and prunes the ones no workspace uses (features/tasks.md). - **Workers query limits are unverified.** Cloudflare's docs do not say whether a D1 `batch()` counts as one query or one per statement toward the per-invocation limit (50 Free / 1000 Paid). The defaults assume the Paid plan; on Free, lower `RECONCILE_MAX_PAGES`. Measure on a real deploy. +- **GitHub refuses account permissions in a manifest.** `email_addresses` made GitHub reject the + whole manifest ("Default permission records resource is not included in the list"). The admin + adds Email addresses: Read in the App settings after creation (self-host README). - **Never tested against real GitHub.** The manifest flow, App availability of `projects_v2*` webhooks, and real payload shapes are covered only by docs and the fake. See STATE. - **Two concurrent refreshes of one user token can lock the user out** (GitHub invalidates the old diff --git a/docs/self-host/README.md b/docs/self-host/README.md index d6eafad..1c1ed4a 100644 --- a/docs/self-host/README.md +++ b/docs/self-host/README.md @@ -103,6 +103,9 @@ and `GITWORK_MIGRATIONS_DIR` pointing at `packages/db/migrations`. One instance 2. **/setup → Create GitHub App.** GitHub asks you to confirm, then returns you to Gitwork. The App is private to your organization. Its webhook URL is `BETTER_AUTH_URL/api/github/webhook`. 3. Install the App on your organization (an org owner must approve). Choose the repos. + Then, in the App's settings on GitHub (Permissions & events → Account permissions), set + **Email addresses** to Read-only. GitHub refuses that permission in the setup manifest, and + without it, people whose GitHub email is private cannot link their GitHub account. 4. Choose who may create accounts (setup step 3). Invites always work. 5. Create a workspace, link your GitHub account (Settings), then link a board and repos. 6. **/setup/health** shows the configuration, the GitHub App, the last webhook, and the last diff --git a/packages/server/src/github/setup.ts b/packages/server/src/github/setup.ts index e26fa02..d101d8b 100644 --- a/packages/server/src/github/setup.ts +++ b/packages/server/src/github/setup.ts @@ -43,8 +43,9 @@ export function buildManifest(baseURL: string, options: { name: string; public: metadata: "read", organization_projects: "write", members: "read", - // Account permission: lets the GitHub link read a private profile email. - email_addresses: "read", + // Not email_addresses: GitHub rejects it in a manifest ("Default permission records resource + // is not included in the list", verified 2026-11-19). It is an account permission; an admin + // adds it in the App's settings after creation (docs/self-host/README.md). }, default_events: [ "issues", diff --git a/packages/server/test/setup.test.ts b/packages/server/test/setup.test.ts index 6fcdb6f..a1f5880 100644 --- a/packages/server/test/setup.test.ts +++ b/packages/server/test/setup.test.ts @@ -48,12 +48,16 @@ describe.each(drivers)("instance setup on $name", (driver: TestDriver) => { ]); }); - it("builds an org manifest with the webhook, callback, and email permission", async () => { + it("builds an org manifest with the webhook and callback, and only permissions GitHub accepts", async () => { const { action, manifest } = await start(); expect(action).toMatch(/^https:\/\/github\.com\/organizations\/acme\/settings\/apps\/new\?state=/); expect(manifest.hook_attributes.url).toBe(`${BASE}/api/github/webhook`); expect(manifest.callback_urls).toEqual([`${BASE}/api/auth/callback/github`]); - expect(manifest.default_permissions).toMatchObject({ organization_projects: "write", email_addresses: "read" }); + expect(manifest.default_permissions).toMatchObject({ organization_projects: "write" }); + // GitHub rejects the whole manifest when it names an account permission such as email_addresses. + for (const key of ["email_addresses", "emails", "followers", "gpg_keys", "profile"]) { + expect(manifest.default_permissions).not.toHaveProperty(key); + } expect(manifest.default_events).not.toContain("installation"); expect(manifest.public).toBe(false); });