Skip to content

docs(legal): say connecting a GitHub account signs you in to GitHub - #33

Merged
kalaspuff merged 1 commit into
mainfrom
fctl/94-currently-a-workspace-owner-that-connect
Oct 20, 2026
Merged

kalaspuff merged 1 commit into
mainfrom
fctl/94-currently-a-workspace-owner-that-connect

Conversation

@fctl-sh

@fctl-sh fctl-sh Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Matches the GitHub-connection change in hyperstructure/fctl: a workspace's
admin now connects a GitHub account by signing in to GitHub with the
instance's GitHub App, instead of an instance admin approving a request.
GitHub tells fctl which of the account's repositories that person may give
the workspace.

The privacy policy is updated to match what app.fctl.sh now does:

  • Receives: the GitHub sign-in gives fctl a short-lived token that says
    which repositories the person may grant; fctl uses it once to read that
    and then revokes it. It does not sign you in to GitHub or keep the token.
  • Stores: each GitHub connection records who connected it and the
    GitHub account they signed in as (replacing "who asked for it and who
    approved it").
  • Sets: a fourth cookie, __Host-fctl-github, protects the GitHub
    sign-in for the 10 minutes it may take.
  • Drops: the GitHub-approval email to admins and the "asking the admins
    to approve a GitHub account" processing purpose.

Must merge together with the fctl pull request (it alters what app.fctl.sh
receives and stores). The fctl docs CI pins this repository when docs/
changes on main; this is a legal/ change, unaffected by that.

fctl PR: hyperstructure/fctl#156
Session: https://app.fctl.sh/s/ses_01M5DG4B4WDKV44T5E9H9HY0AC

A workspace's admin now connects a GitHub account by signing in to
GitHub, which shows fctl which of the account's repositories they may
give the workspace, instead of an instance admin approving a request. The
policy says what that sign-in receives (a short-lived token, used once and
revoked), records (who connected it and the GitHub account they signed in
as) and sets (the __Host-fctl-github cookie), and drops the approval
request and its email.
@kalaspuff
kalaspuff merged commit 5196798 into main Oct 20, 2026
4 checks passed
@kalaspuff
kalaspuff deleted the fctl/94-currently-a-workspace-owner-that-connect branch October 20, 2026 21:26
kalaspuff pushed a commit to hyperstructure/fctl that referenced this pull request Oct 20, 2026
…-in (#156)

## Why

On an instance that hosts more than one team (app.fctl.sh), a workspace
owner who connected a GitHub account needed an **instance admin to
approve**
it, and an instance admin could connect **any** installed account to
**any**
workspace. Both are wrong: connecting an account should be the
workspace's
own decision, and nobody — instance admins included — should be able to
point one person's workspace at another person's organization and have
that
workspace's agents write to repositories its people never had access to.
The instance's one GitHub App can mint a writing token for every account
it
is installed on, so the only thing standing between a workspace and
someone
else's code was an admin's judgement.

The reason the old flow leaned on an admin: GitHub's setup redirect
carries
an `installation_id` that anyone can forge, so naming an installation
proved
nothing. The fix is to ask GitHub, as the person, instead of trusting a
redirect or an admin.

## What changed

**Workspaces connect GitHub accounts themselves, with a GitHub
sign-in.**
A workspace's admin who connects an account is sent to GitHub to sign in
with the app (OAuth, PKCE). fctl trades the code for a short-lived user
access token, reads what that person may grant, uses it once and revokes
it — no refresh token, nothing stored, the token never leaves the
control
plane. `fctl_domain::github::grant` turns what GitHub reports into the
connection:

- **Your own account**, or **an organization whose every repository the
app
reaches and you administer all of** (as its owners do): every
repository,
  also those the app reaches there later.
- **Otherwise**: the repositories you administer, by name, at the moment
you
connect. `--repo`/named repositories are kept only where you both see
them
  through the installation and administer them.

The installation is found among those the token can see
(`GET /user/installations`), never by id alone, so connecting reveals
nothing about where else the app is installed, and a forged
`installation_id`
finds nothing. **Instance admins approve nothing and connect nothing** —
they
see the app's installations and the workspaces using each, and can take
an
account away from a workspace (a brake, not a way in). See
[ADR
0029](docs/adr/0029-workspaces-connect-github-accounts-with-a-github-sign-in.md).

**A session's tokens go only to the runner it runs on.** Found while
investigating cross-workspace leakage: the fleet answered *any*
connected
runner's credential request for *any* session, and took any runner's
start
result and Claude sign-in update. A runner serves only the workspaces
its
owner added it to, so a runner of one workspace could ask for the GitHub
installation tokens or the Claude credential of a session in another
workspace and get them. The fleet now mints a session's credentials only
for the runner it is assigned to (as the session uplink already
checked),
ignores a start result from a runner the session is not assigned to, and
takes a Claude sign-in update only from the runner the sign-in was sent
to.

## What the GitHub App needs (instance operators)

Answering the question in the session — to connect accounts after this
change, the instance's GitHub App needs:

1. A **client secret** (`GITHUB_CLIENT_SECRET`) — the client ID was
already
   configured; the secret signs workspace admins in to GitHub.
2. A **Callback URL** registered:
`{FCTL_PUBLIC_URL}/api/v1/github/authorized`.
Leave "Request user authorization (OAuth) during installation" **off** —
   fctl starts the sign-in itself.

**No new GitHub App permissions**: reading a user's installations and
their
repositories (with the per-repo `permissions.admin` flag) needs only
Metadata, which the app already has. Without the client secret a
workspace
keeps the accounts it has but connects no new one, and its GitHub tab
says
so. **app.fctl.sh's admins must set `GITHUB_CLIENT_SECRET` and the
callback
URL** (an instance-admin action this session's token can't do) before
anyone
can connect a new account there.

`BREAKING CHANGE:` connecting a GitHub account now requires the app's
client
secret (`GITHUB_CLIENT_SECRET`) and a callback URL
(`…/api/v1/github/authorized`); existing connections keep working
without
them. `fctl workspaces connect` now opens a GitHub sign-in in the
browser
instead of connecting in one call, and `fctl admin github approve` is
gone
(instance admins no longer approve or connect). The migration drops
GitHub
connections still waiting for approval; their admins reconnect them.

## How verified

- `cargo xtask check` (full) and `cargo xtask dev --smoke` pass — the
smoke
run confirms normal session start still works with the runner-credential
  change on the hot path.
- Unit tests for `fctl_domain::github::grant` (own account, org owner,
  member with some admin repos, nobody-administers, named-repo refusals,
  more-than-a-connection-lists) and the new cookie.
- Web tests for the workspace GitHub tab (the sign-in connect flow, the
  returned banners, the member view, the no-client-secret state) and the
  admin tab; `web/ npm run check` and `vitest` green.
- The real GitHub OAuth round-trip can't run against `cargo xtask dev`
(no
GitHub App); the screenshots below render the real components against
the
  dev stack with the GitHub API responses mocked (injected data, no
  secrets).

## Screenshots

At 9fd96fe, light theme, 1280 px wide (data injected — the dev stack has
no
GitHub App).

### Workspace GitHub tab

| Before (approval flow) | After (GitHub sign-in) |
|---|---|
| ![Before: workspace GitHub tab, waiting for an instance
admin](https://app.fctl.sh/api/v1/published/YWpW7nCCvyAzGRkLmWCe0QZTFxHR3gaWgExvFAhPdiE/before-ws-github-light.png)
| ![After: workspace GitHub tab, Connect with
GitHub](https://app.fctl.sh/api/v1/published/GUA95ypteReSEz5WgC1yoACOFN3s6P0uOpJemKMJ9kt/ws-github-light.png)
|

Before, a named account waits "for an instance admin" and the button is
a
plain "Connect". After, each connection shows who connected it and the
GitHub account they signed in as, and the button is "Connect with
GitHub".

After, dark, and the banner when GitHub limited the connection to the
repositories you administer:

| After (dark) | After signing in (limited to repos you administer) |
|---|---|
| ![After: workspace GitHub tab,
dark](https://app.fctl.sh/api/v1/published/V435J9PfxoOjgoBpRKtmmBt7VPwngdgcRtcAYaOksXM/ws-github-dark.png)
| ![After: banner saying it connected the repositories you
administer](https://app.fctl.sh/api/v1/published/3FYzgKHTILWVGi7Jt080r0yuZnQCpTvHzAkRyjRp0Z9/ws-github-limited.png)
|

### Admin → GitHub

| Before (approve/connect) | After (read-only, can remove) |
|---|---|
| ![Before: admin GitHub tab with an approval request and Connect to a
workspace](https://app.fctl.sh/api/v1/published/HZnc5f0f5KESn6yq95dw65CiScmKVNf01kMMp94OUqH/before-admin-github-light.png)
| ![After: admin GitHub tab listing installations and the workspaces
using
each](https://app.fctl.sh/api/v1/published/TdzKoxqWh2l6ijgeflhZbrHMEMqhxpAga4fIA0tkDvD/admin-github-light.png)
|

Before, instance admins approve requests, connect accounts to workspaces
and
install on other accounts. After, the tab is read-only: installations
and
the workspaces using each, with the option to take an account away.

## Companion PR

Privacy policy, which must merge together with this:
hyperstructure/fctl-site#33

Session: https://app.fctl.sh/s/ses_01M5DG4B4WDKV44T5E9H9HY0AC

---------

Co-authored-by: fctl-sh[bot] <fctl-sh[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant