Repository navigation
fix: close CLI proxy alias and interspersed-flag bypasses - #11470
Conversation
Match gh's command discovery for interspersed flags and canonicalize built-in aliases before enforcing shim-bypass and meta-command denials. Preserve accepted argv and the separate enclave grammar, with policy, HTTP recording-fixture, and real-gh help-only regressions. Resolves githubnext/gh-aw-security#3383 Resolves githubnext/gh-aw-security#3388 Co-authored-by: Copilot App <[email protected]>
Documentation PreviewDocumentation has been built for this PR. To view locally:
Built from commit 9c8fc3b |
There was a problem hiding this comment.
🟡 Changes recommended
The proxy’s UTF-16 length check diverges from the pinned CLI’s UTF-8 parsing and can miss denied command paths, while contract tests do not ensure they use the pinned CLI version.
2 open issues
What changed in this PR
This PR hardens AWF’s GitHub CLI proxy by updating command classification to address alias and interspersed-flag bypasses while preserving allowed arguments and enclave validation.
Changes:
- Models Cobra command discovery and canonicalizes policy-controlled aliases.
- Adds policy, HTTP dispatch, unchanged-argv, and real-
ghparser regressions. - Documents the pinned-parser contract and image rebuild/deployment requirement.
| File | Description |
|---|---|
docs/gh-cli-proxy-design.md |
Documents classification behavior, version alignment, and rollout requirements. |
containers/cli-proxy/server.test.js |
Adds discovery, alias, dispatch-boundary, and enclave regressions. |
containers/cli-proxy/security.js |
Replaces adjacency-based checks with shallow command discovery and alias normalization. |
Review effort: Max (auto)
| const result = spawnSync('gh', [...args, '--help'], { | ||
| cwd: directory, env, encoding: 'utf8', timeout: 5000, | ||
| }); |
|
Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.
|
|
✅ Build Test Suite completed successfully! Build Test SuiteOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅ Smoke Copilot Network IsolationOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅
|
|
✅ Smoke Claude passed
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
🚀 Security Guard has started processing this pull request |
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. Smoke ChrootOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓
|
|
🔌 Smoke Services — All services reachable! ✅
|
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 Smoke CodexOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: lpcox <[email protected]>
Addressed in |
|
✅ Copilot review passed with no inline comments. @lpcox Add the |
|
✅ Smoke Claude passed
|
|
📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅ Smoke OTel TracingOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓 Smoke Copilot BYOKOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤
|
|
Smoke Cloud Hypervisor completed. Cloud Hypervisor + Copilot passed.
|
|
✅ Security Guard completed successfully! Security GuardOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🛡️ Smoke Copilot Network Isolation confirmed the egress allowlist is enforced. ✅
|
|
🔌 Smoke Services — All services reachable! ✅
|
|
✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟 Smoke CodexOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded. Smoke ChrootOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ Build Test Suite completed successfully! Build Test SuiteOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
EGRESS_RESULT allow=pass deny=pass
Overall: PASS — cc @lpcox
|
Smoke Test: Claude Engine Validation
Overall result: PASS
|
Smoke Test
|
🏗️ Build Test Suite Results
Overall: 7/8 ecosystems passed — FAIL Java failure details:
Notes:
|
Smoke Test: Copilot BYOK (Direct) Mode ✅Test Results:
Status: PASS — Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY) via api-proxy sidecar
|
|
Cloud Hypervisor + Copilot smoke test
Overall: PASS
|
|
OTEL smoke test
|
|
Smoke Copilot: PR "feat: send each budget notice once to every conversation in the run"
Overall: PASS — @lpcox
|
Chroot Version Comparison
Result: Not all tests passed (Node.js version mismatch), so the
|
|
Smoke services: ✅ Redis PONG · ✅ pg_isready · ✅ SELECT 1 — PASS
|


Summary
ghCLI's shallow Cobra discovery semantics rather than literal argv adjacency or a generic flag/value guess. Handle separate, equals, and attached flag values, discovery-time booleans, flags before/between command words, and--termination.co/pr co→pr checkout,cs→codespace, andext/extensions→extension.issues-read-v1grammar. Document the parser/version contract and image rollout requirement.Resolves githubnext/gh-aw-security#3383
Resolves githubnext/gh-aw-security#3388
Evidence and validation
Both reports remain reproducible on current main (
32541bf3cdccf9ee6490366fcf2b78777df156f0); no existing fix PR was found. Against that baseline, the real HTTP handler dispatchedco 42,pr co 42,pr -R owner/repo checkout 42, andpr -Rowner/repo checkout 42to an inert recording executable (200), while literalpr checkout 42was rejected (403).The new regressions assert denied inputs receive 403 without any fixture dispatch and allowed controls reach the fixture with byte-for-byte unchanged argv. Coverage includes alias/flag combinations, every existing denied command path, flag placement,
--, command-like values/operands, invalid syntax that never selects a denied leaf, and enclave routing.gh2.102.1, then again with the sidecar's exact pinnedgh2.98.0 (official release checksum verified).npm run lintpassed (pre-existing warnings);npm run buildandgit diff --checkpassed.Scope and rollout
The reports'
repo -R ... clone/gist -R ... clonevariants are rejected by real gh as unsupported flags, unlike the confirmedpr -R ... checkoutform. Policy still rejects their discovered denied command paths; this PR does not claim those unsupported variants execute in gh.The discovery/alias table is deliberately limited to the policy-controlled boundaries and must remain aligned with the Dockerfile's pinned gh version. User aliases are not loaded from an agent-controlled config. No api-proxy/mcpg changes, security-card/pin edits, live workflow dispatches, or deployment changes are included. The repair takes effect only after a rebuilt CLI-proxy image is deployed; existing images remain unchanged.