fix(security): fail-closed gh gate for external projects (LIA-361)#1013
Merged
Conversation
The tool-proxy push/merge gate only flagged `gh merge` / `gh pr merge|create` by subcommand position, so `gh api -X PUT .../pulls/1/merge` -- and `gh alias`, `gh extension`, `gh secret`, etc. -- ran with the host operator's GitHub credentials from a non-allowlisted external-project container, bypassing the externalPushDenialReason trust boundary (LIA-180). Flip `isPushOrMergeTool`'s `gh` handling from a denylist to a fail-closed allowlist: only an explicit set of read subcommands (pr/issue/repo/release/run/ workflow view|list|..., gh search <target>) and a provably-GET `gh api` pass through; every other subcommand -- including alias/extension (which persist an alias or install code that later runs with host creds) and any unknown one -- is gated. `gh api` mutation detection uses a real POSIX shorthand-cluster walk, not string-prefix matching, so `-if k=v` / `-iX PUT` (a value flag hidden behind the boolean `-i`/`--include`) and glued/`=`/dangling/long forms are all caught, plus a defense-in-depth scan for an X-HTTP-Method-Override header. Only affects untrusted external projects: externalPushDenialReason still returns null for the home/control project and allowlisted external projects, unchanged. Tests: independent oracle suite (authored blind to the implementation) + a regression block for the shorthand-cluster bypass. Full suite green (1990). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sliamh11
added a commit
that referenced
this pull request
Jul 17, 2026
🤖 I have created a release *beep* *boop* --- ## [1.27.0](v1.26.0...v1.27.0) (2026-07-17) ### Features * **deus-v2:** validate subscription billing through credential proxy (LIA-397) ([#1035](#1035)) ([38aa247](38aa247)) ### Bug Fixes * **admin-merge-gate:** allow admin-merge on plan-limited private repos ([#1055](#1055)) ([8d283a9](8d283a9)) * **admin-merge-gate:** exclude known-advisory checks from plan-limited fallback ([#1056](#1056)) ([8e67e6a](8e67e6a)) * **admin-merge-gate:** scope internal gh calls to the gated command's --repo ([#1054](#1054)) ([545b941](545b941)) * **code-search:** sweep orphaned rowids from vec/fts on reindex (LIA-368) ([#1042](#1042)) ([fad4885](fad4885)) * **ingress:** don't kill the OAuth refresh timer on a port-conflict retry (LIA-363) ([#1020](#1020)) ([0cf61dd](0cf61dd)) * **memory:** exclude orphaned entries from FTS query (LIA-370) ([#1040](#1040)) ([0645453](0645453)) * **memory:** re-embed nodes missing an embedding row (LIA-369) ([#1041](#1041)) ([f2855b0](f2855b0)) * **memory:** repair entries_fts write-path drift (LIA-370) ([#1043](#1043)) ([1414898](1414898)) * **runtime:** handle stream errors on tool-proxy req + container stdin (LIA-362, LIA-385) ([#1021](#1021)) ([df9df3f](df9df3f)) * **security:** fail-closed gh gate for external projects (LIA-361) ([#1013](#1013)) ([ee9b62e](ee9b62e)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Closes the
gh apicredential-escalation bypass found by the 2026-07-03 system audit (V2 re-audit re-confirmed it live on origin/main). Roadmap step 2, PR 1 of 3.The tool-proxy push/merge gate only flagged
gh merge/gh pr merge|createby subcommand position.gh api -X PUT .../pulls/1/merge— andgh alias set,gh extension install,gh secret set, etc. — matched none of the guarded tokens and ran with the host operator's real GitHub credentials from a non-allowlisted external-project container, bypassingexternalPushDenialReason(the LIA-180 trust boundary).How
isPushOrMergeTool'sghhandling flips from a denylist (allow unless recognized-bad) to a fail-closed allowlist:pr/issue/repo/release/run/workflow view|list|…,gh search <code|commits|issues|prs|repos>) and a provably-GETgh apipass through.alias/extension(persist an alias / install code that later runs with host creds),secret,pr merge|create|close, and any unknown subcommand — is gated.gh apimutation detection uses a real POSIX shorthand-cluster walk, not string-prefix matching, so-if k=v/-iX PUT(a value flag hidden behind the boolean-i/--include), plus glued/=/dangling/long forms, are all caught. Defense-in-depth scan for anX-HTTP-Method-Overrideheader.Only untrusted external projects are affected:
externalPushDenialReasonstill returnsnullfor the home/control project and allowlisted external projects (unchanged).Review trail
alias/extensionbypass → flipped to allowlist).gh api -if k=vPOSIX-cluster hid the value flag; verified executing a live POST against realghv2.92.0) → fixed with the cluster walker → round-2 SHIP.Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com