Skip to content

Authorize allowlisted GitHub App actors on repository_dispatch - #63492

Merged
pelikhan merged 8 commits into
mainfrom
copilot/fix-role-gate-issues
Sep 26, 2026
Merged

pelikhan merged 8 commits into
mainfrom
copilot/fix-role-gate-issues

Conversation

Copilot AI commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

on.roles: is matched against repository collaborator roles, and GitHub App identities are never collaborators — so an App-sent repository_dispatch always resolved to permission none and the run was skipped at pre-activation. The documented escape hatch, on.bots:, was broken for the same reason: checkBotStatus verifies installation through the same collaborator API and reported the App as "not active/installed".

Changes

  • actions/setup/js/check_membership.cjs: checkBotAllowlistAuthorization takes an installationCheckOptional option, set by main() only for repository_dispatch. An allowlisted actor whose collaborator lookup conclusively reports "not a collaborator" is authorized, since posting a repository_dispatch already requires contents: write on the repository.
  • Guardrails: only actors explicitly listed in on.bots: are admitted — everyone else still goes through the normal on.roles: gate; transient lookup failures (5xx, rate limiting) set error and still deny; all other events are unchanged and still require the bot to be installed.
  • Tests: allowlisted App admitted on repository_dispatch, non-allowlisted App still denied, other events still require installation, transient failure still denies.
  • Docs (reference/triggers.md): the repository_dispatch and on.bots: sections now state that App senders are admitted via on.bots: rather than on.roles:.

Working configuration for an App→App chain:

on:
  repository_dispatch:
    types: [agent-handoff]
  bots: ["my-app"]   # [bot] suffix optional

Deliberately not implemented: blanket exemption of all repository_dispatch senders, which would silently downgrade a workflow declaring roles: [admin] to "anyone with write access".

Unrelated to the code change, two claims in the issue do not reproduce on main: on.roles: does change the compiled GH_AW_REQUIRED_ROLES (a top-level roles: key is rejected with a schema error pointing at on.roles), and there is no none/any value — all is the documented "no restrictions" setting.


Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 30.8 AIC · ⌖ 8.67 AIC · ⊞ 9.6K · ◷
Comment /souschef to run again

Copilot AI and others added 2 commits September 25, 2026 19:26
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix role gate rejecting GitHub App actors on repository_dispatch Authorize allowlisted GitHub App actors on repository_dispatch Sep 25, 2026
Copilot AI requested a review from pelikhan September 25, 2026 19:28
@pelikhan
pelikhan marked this pull request as ready for review September 25, 2026 19:53
Copilot AI balanced review requested due to automatic review settings September 25, 2026 19:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The new error guard can fail open for an empty error message, and the documentation inaccurately describes some authorization paths.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 2 Low severity

Open (3)
What changed in this PR

Enables allowlisted GitHub Apps to trigger repository_dispatch workflows while retaining existing authorization behavior elsewhere.

Changes:

  • Relaxes App installation verification for allowlisted repository dispatches.
  • Adds authorization and failure-path tests.
  • Documents the behavior and adds a patch changeset.
File Description
actions/​setup/​js/​check_membership.cjs Implements conditional App authorization.
actions/​setup/​js/​check_membership.test.cjs Tests dispatch authorization guardrails.
docs/​src/​content/​docs/​reference/​triggers.md Documents App-triggered dispatches.
.changeset/​repository-dispatch-app-bots.md Records the patch release change.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread actions/setup/js/check_membership.cjs Resolved

Omit `types:` to fire on any `event_type`.

The dispatch sender still goes through the [role check](#filtering-by-repository-access-roles-onroles-onskip-roles). A PAT-based sender is checked against `on.roles:`; a GitHub App sender is never a repository collaborator and must be allowlisted with [`on.bots:`](#filtering-by-bot-onbots-onskip-bots).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qualified in d9fc499 — the sentence now reads "Unless on.roles: all is set (which disables the check entirely), the dispatch sender goes through the role check."


The `[bot]` suffix is optional — `github-actions` matches `github-actions[bot]` automatically.

Allowlisted bots must be installed on the repository, which is verified through the repository collaborator API. GitHub App identities are not collaborators, so that lookup finds nothing for them. On `repository_dispatch` the check is therefore relaxed: an allowlisted App is authorized without the installation lookup, because sending the event already requires `contents: write` access to the repository. This is how an App-triggered `repository_dispatch` is admitted — `on.roles:` is matched against repository collaborator roles and never matches an App sender.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reworded in d9fc499 to describe the actual fail-closed behavior: the lookup is still performed, authorization happens only on a conclusive "not a collaborator" result, and a failed lookup (outage/rate limit) is still denied.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please review the current head, address any remaining maintainer feedback, refresh the branch if needed, and continue with the pr-finisher skill.

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 30.8 AIC · ⌖ 8.67 AIC · ⊞ 9.6K · ◷
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot update safe output specs and specs tests.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Please review the current head, address any remaining maintainer feedback, refresh the branch if needed, and continue with the pr-finisher skill.

Generated by 👨🍳 PR Sous Chef

Generated by 👨‍🍳 PR Sous Chef · pi · gpt54 · 25.1 AIC · ⌖ 8.84 AIC · ⊞ 9.3K · ◷
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot update safe output specs and specs tests.

Updated the threat-detection specification, compliance crosswalk, changelog, and formal specification coverage for the repository_dispatch App authorization rule in fccae12.

Copilot AI and others added 2 commits September 25, 2026 21:18
…-issues

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Sep 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Please review the current head, address any remaining maintainer feedback, refresh the branch if needed, and continue with the pr-finisher skill.

Generated by [👨🍳 PR Sous Chef](htt...

Refreshed the branch from current main in merge commit 6274b77 and completed the required local validation.

@pelikhan
pelikhan merged commit 24043bc into main Sep 26, 2026
45 checks passed
@pelikhan
pelikhan deleted the copilot/fix-role-gate-issues branch September 26, 2026 05:16
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.89.22

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.

Role gate rejects GitHub App (bot) actors on repository_dispatch

4 participants