Skip to content

fix(github): resolve write actors for org-installed App tokens - #207

Open
yonatangross wants to merge 1 commit into
vercel-labs:mainfrom
yonatangross:fix/github-installation-actor-writes
Open

fix(github): resolve write actors for org-installed App tokens#207
yonatangross wants to merge 1 commit into
vercel-labs:mainfrom
yonatangross:fix/github-installation-actor-writes

Conversation

@yonatangross

Copy link
Copy Markdown

Summary

  • assertRepoWrite / assertIssueWrite now resolve the actor (assertAuthenticatedActor: <slug>[bot] for installation tokens, the user otherwise) instead of the user-only assertAuthenticatedUser
  • Issue writes additionally check the installation's issues / pull_requests write permission, like GitHub

Why

An installation token's AuthUser.login is the installation account login. For an App installed on an organization that login is the org, which is not a row in users, so every issue, milestone, label, comment and pull-request write with an org-installed App token answered 401 "Requires authentication" while reads worked. User-account installs only worked by accident: the write was attributed to the account user rather than the app's [bot] actor that installationActor() already builds.

Found while running Yonatan-HQ/platform's emulate tier with the seed's App installed on the org (the prod shape: promote auto-merge writes with an org-installed App).

Changes

File Change
route-helpers.ts assertRepoWrite / assertIssueWrite via assertAuthenticatedActor; installation permission gate on issue writes
__tests__/installation-writes.test.ts org-installed App mints a token, creates issue / milestone / labels / comment / branch / PR as my-app[bot]; no-token write still 401

Not touched: pulls.ts update-branch still uses assertAuthenticatedUser; same class, left for a separate change to keep this one small.

Test plan

  • pnpm --filter @emulators/github test (5 files pass, 3 new cases)
  • pnpm -r build
  • pnpm --filter @emulators/github lint (0 errors, no new warnings)

An installation token's AuthUser.login is the installation ACCOUNT login.
For an App installed on an organization that login is the org, which is
not a row in users, so assertRepoWrite/assertIssueWrite (via the user-only
assertAuthenticatedUser) answered 401 to every issue, milestone, label,
comment and pull-request write. User-account installs only worked by
accident: the write was attributed to the account user instead of the
app's <slug>[bot] actor.

Resolve write actors with assertAuthenticatedActor (installationActor for
installations, the user otherwise), and gate issue writes on the
installation's issues/pull_requests permission like GitHub does.
@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@yonatangross is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant