From 82cb989414f051dba6f98bd6be4a134b5eb2a4a4 Mon Sep 17 00:00:00 2001 From: Nam Rodriguez Date: Wed, 4 Nov 2026 11:11:22 -0500 Subject: [PATCH] Sign in with GitHub on hybrid installs, through Coderhelm's app The API now offers GitHub sign-in on a hybrid install registered with Coderhelm (coderhelm-platform #459): /auth/github on the install goes through Coderhelm's GitHub App and the install checks the account itself. - Settings, System, Hybrid, Other apps: Sign in with GitHub has the new mode included ("On through Coderhelm's app") with what passes through Coderhelm and what stays with the install; no Google mention. - The sign-in page already follows GET /auth/methods; comments say how a hybrid install gets GitHub. - e2e: a registered hybrid install shows Continue with GitHub, starting at the install's own /auth/github; the Other apps card shows the new copy with nothing to choose. --- dashboard/e2e/hybrid.spec.ts | 12 +++++++++-- dashboard/e2e/sign-in-methods.spec.ts | 24 ++++++++++++++++----- dashboard/src/components/hybrid-section.tsx | 6 ++++-- dashboard/src/hooks/use-sign-in-methods.ts | 6 ++++-- dashboard/src/lib/api.ts | 2 +- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/dashboard/e2e/hybrid.spec.ts b/dashboard/e2e/hybrid.spec.ts index b60d61c0..7f0e310a 100644 --- a/dashboard/e2e/hybrid.spec.ts +++ b/dashboard/e2e/hybrid.spec.ts @@ -56,7 +56,7 @@ function status(s: State) { { id: "slack_notifications", name: "Slack and Teams notifications", mode: "direct", through_coderhelm: "", stays_with_you: "", uses_coderhelm: false }, { id: "mcp_apps", name: "Figma, Linear, Sentry, Sanity and other sign-in apps", mode: "direct", through_coderhelm: "", stays_with_you: "", uses_coderhelm: false }, { id: "slack_commands", name: "Slack and Teams commands", mode: "unavailable", through_coderhelm: "", stays_with_you: "", reason: "CoderHelm has no shared Slack or Teams app: each team connects its own app's signing secret in Plugins settings, so there is nothing to relay. That keeps working the same way on a hybrid install.", uses_coderhelm: false }, - { id: "github_sign_in", name: "Sign in with GitHub", mode: "unavailable", through_coderhelm: "", stays_with_you: "", reason: "Signing people in to your install with GitHub needs your own GitHub App: a hosted app's sign-in would hand CoderHelm your people's identities. Use email sign-in, or Google with your own domain.", uses_coderhelm: false }, + { id: "github_sign_in", name: "Sign in with GitHub", mode: "included", through_coderhelm: "Without a GitHub OAuth client of your own, GitHub's sign-in page is CoderHelm's GitHub App: CoderHelm passes GitHub's one-time code to your install, exchanges it when your install asks (with a secret only your install holds), and revokes the token at GitHub seconds later. It stores neither and doesn't ask GitHub who signed in.", stays_with_you: "Who signs in: your install asks GitHub itself whose account it is, then applies its own rules (team members and invites, two-factor). CoderHelm can't start a session on your install or choose who signs in.", reason: "", uses_coderhelm: false }, ], sharing: s.sharing, checks, @@ -319,7 +319,15 @@ test("other apps: each choice sends only that tool; direct and unavailable say s await expect(page.getByTestId("hybrid-integration-slack_notifications")).toContainText("Works from your install, no app needed"); await expect(page.getByTestId("hybrid-integration-mcp_apps")).toContainText("Works from your install, no app needed"); await expect(page.getByTestId("hybrid-integration-slack_commands")).toContainText("Not available"); - await expect(page.getByTestId("hybrid-integration-github_sign_in")).toContainText("needs your own GitHub App"); + // Sign in with GitHub works through Coderhelm's app: on, nothing to choose, + // and the card says the install decides who signs in. + const signIn = page.getByTestId("hybrid-integration-github_sign_in"); + await expect(signIn).toHaveAttribute("data-mode", "included"); + await expect(signIn).toContainText("On through Coderhelm's app"); + await expect(signIn).toContainText("your install asks GitHub itself whose account it is"); + await expect(signIn).not.toContainText("Google"); + await expect(signIn).not.toContainText("Not available"); + await expect(signIn.getByRole("button")).toHaveCount(0); // GitHub has its own row above, so it isn't listed again. await expect(page.getByTestId("hybrid-integration-github")).toHaveCount(0); }); diff --git a/dashboard/e2e/sign-in-methods.spec.ts b/dashboard/e2e/sign-in-methods.spec.ts index f72e7c3b..6c98a42d 100644 --- a/dashboard/e2e/sign-in-methods.spec.ts +++ b/dashboard/e2e/sign-in-methods.spec.ts @@ -1,10 +1,11 @@ import { expect, test, type Page, type Route } from "@playwright/test"; // The sign-in screen shows only the ways in that work on this deployment, as -// the API's GET /auth/methods says. A self-hosted install on Coderhelm's -// GitHub App (hybrid) has no GitHub OAuth client of its own, so it offers no -// GitHub button: before this, the button sent people to GitHub with an empty -// client_id and GitHub answered 404. Every API call is answered here. +// the API's GET /auth/methods says. A self-hosted install offers GitHub with +// an OAuth client of its own, or on Coderhelm's GitHub App (hybrid) once it is +// registered: the same /auth/github then goes through Coderhelm's app and the +// install checks the account itself. An install with neither shows no GitHub +// button. Every API call is answered here. type Methods = { password: boolean; google: boolean; github: boolean }; @@ -41,7 +42,7 @@ async function mockApi(page: Page, opts: { selfHosted: boolean; methods: Methods const github = (page: Page) => page.getByRole("link", { name: "Continue with GitHub" }); const google = (page: Page) => page.getByRole("link", { name: "Continue with Google" }); -test("hybrid install with no GitHub client: email and password only, no GitHub button and no 'or'", async ({ page }) => { +test("self-hosted install with no way to GitHub: email and password only, no GitHub button and no 'or'", async ({ page }) => { const { calls } = await mockApi(page, { selfHosted: true, methods: { password: true, google: false, github: false } }); await page.goto("/"); await expect(page.getByLabel("Email")).toBeVisible(); @@ -62,6 +63,19 @@ test("self-hosted install with its own GitHub client: the GitHub button goes to await expect(page.getByText("or", { exact: true })).toBeVisible(); }); +test("hybrid install registered with Coderhelm: GitHub is offered and starts at the install's own /auth/github", async ({ page }) => { + const { calls } = await mockApi(page, { selfHosted: true, methods: { password: true, google: false, github: true } }); + await page.goto("/"); + await expect.poll(() => calls.includes("/auth/methods")).toBe(true); + await expect(github(page)).toBeVisible(); + // The install's API starts the trip (it then goes through Coderhelm's app), + // never a Coderhelm address in the page itself. + await expect(github(page)).toHaveAttribute("href", "/auth/github"); + await expect(github(page)).not.toHaveAttribute("href", /coderhelm\.com/); + await expect(google(page)).toHaveCount(0); + await expect(page.getByLabel("Email")).toBeVisible(); +}); + test("self-hosted install whose API has no method list yet: no GitHub button", async ({ page }) => { await mockApi(page, { selfHosted: true, methods: "missing" }); await page.goto("/"); diff --git a/dashboard/src/components/hybrid-section.tsx b/dashboard/src/components/hybrid-section.tsx index fc5634df..d14ae775 100644 --- a/dashboard/src/components/hybrid-section.tsx +++ b/dashboard/src/components/hybrid-section.tsx @@ -666,15 +666,17 @@ function IntegrationItem({ i, hybrid, s }: { i: HybridIntegration } & RowProps) /> ) : i.mode === "direct" ? ( Works from your install, no app needed + ) : i.mode === "included" ? ( + On through Coderhelm's app ) : ( Not available )} {notOffered &&

Use your own {i.name} app for now.

} - {i.mode === "hosted" && !notOffered && (i.through_coderhelm || i.stays_with_you) && ( + {(i.mode === "hosted" || i.mode === "included") && !notOffered && (i.through_coderhelm || i.stays_with_you) && (
{i.through_coderhelm && ( -
+
Through Coderhelm
{i.through_coderhelm}
diff --git a/dashboard/src/hooks/use-sign-in-methods.ts b/dashboard/src/hooks/use-sign-in-methods.ts index d681608c..ced09483 100644 --- a/dashboard/src/hooks/use-sign-in-methods.ts +++ b/dashboard/src/hooks/use-sign-in-methods.ts @@ -7,8 +7,10 @@ import { isSelfHosted } from "@/lib/runtime-config"; // The sign-in methods that work on this deployment, from the API // (`GET /auth/methods`): the sign-in screen shows these and no others, so it // never offers a button that ends on someone else's error page. A -// self-hosted install has GitHub only with an OAuth client of its own; an -// install on Coderhelm's GitHub App (hybrid) has none. +// self-hosted install has GitHub with an OAuth client of its own, or, on +// Coderhelm's GitHub App (hybrid), once it is registered with Coderhelm: the +// same /auth/github then goes through Coderhelm's app and the install still +// decides who signs in. // // Until the API answers, and when it can't (an older gateway), the hosted // service keeps Google and GitHub and a self-hosted install shows email and diff --git a/dashboard/src/lib/api.ts b/dashboard/src/lib/api.ts index f2f7527e..162eb745 100644 --- a/dashboard/src/lib/api.ts +++ b/dashboard/src/lib/api.ts @@ -4574,7 +4574,7 @@ export interface HybridGithubLink { export interface HybridIntegration { id: HybridIntegrationId; name: string; - mode: "hosted" | "direct" | "unavailable"; + mode: "hosted" | "direct" | "included" | "unavailable"; through_coderhelm: string; stays_with_you: string; reason?: string;