Skip to content

fix(security): fail-closed gh gate for external projects (LIA-361)#1013

Merged
sliamh11 merged 2 commits into
mainfrom
worktree-lia361-gh-gate
Jul 13, 2026
Merged

fix(security): fail-closed gh gate for external projects (LIA-361)#1013
sliamh11 merged 2 commits into
mainfrom
worktree-lia361-gh-gate

Conversation

@sliamh11

Copy link
Copy Markdown
Owner

What

Closes the gh api credential-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|create by subcommand position. gh api -X PUT .../pulls/1/merge — and gh 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, bypassing externalPushDenialReason (the LIA-180 trust boundary).

How

isPushOrMergeTool's gh handling flips from a denylist (allow unless recognized-bad) to a fail-closed allowlist:

  • Only explicit read subcommands (pr/issue/repo/release/run/workflow view|list|…, gh search <code|commits|issues|prs|repos>) and a provably-GET gh api pass through.
  • Everything else — 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 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), plus glued/=/dangling/long forms, are all caught. Defense-in-depth scan for an X-HTTP-Method-Override header.

Only untrusted external projects are affected: externalPushDenialReason still returns null for the home/control project and allowlisted external projects (unchanged).

Review trail

  • Plan-reviewer SHIP (2 rounds: round 1 REVISE caught alias/extension bypass → flipped to allowlist).
  • A round-1 code-reviewer BLOCK caught a real fail-open (gh api -if k=v POSIX-cluster hid the value flag; verified executing a live POST against real gh v2.92.0) → fixed with the cluster walker → round-2 SHIP.
  • 5 warden SHIPs: code-reviewer (claude+gpt+glm), ai-eng-warden (claude+gpt), verification-gate.
  • Tests: independent oracle suite authored blind to the implementation + a regression block for the cluster bypass. Full suite green (1990); tsc clean.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com

sliamh11 and others added 2 commits July 13, 2026 20:12
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>
@github-actions github-actions Bot added the core label Jul 13, 2026
@sliamh11
sliamh11 merged commit ee9b62e into main Jul 13, 2026
14 of 15 checks passed
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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant