feat(gh): proxy gh pr diff/checks, gh run list/view/rerun, allowlisted read-only gh api#39
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d38cde7. Configure here.
| ) { | ||
| return refuse(`field flag '${arg}' makes the request mutating`); | ||
| } | ||
| } |
There was a problem hiding this comment.
Write guard misses combined short-flag forms like -XPOST
Medium Severity
refuseGhApiWrite checks arg === '-X' (exact match), so combined short-flag forms like -XPOST, -fkey=value, or -Fkey=value — which Go's pflag library (used by gh) typically accepts — bypass the server-side write guard entirely. The in-box shim's strict_flags catches these at the first layer, but the relay-side check is the last line of defense and can be reached directly via agentbox-ctl. The endpoint allowlist limits practical damage, but this is a gap in the stated defense-in-depth strategy.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit d38cde7. Configure here.
…POST, -fkey=val) Bugbot: refuseGhApiWrite used exact-match (arg === '-X'), so pflag's combined short forms bypassed the relay-side guard. Recognize -X<value>/-X=<value> and any -f*/-F* spelling. The box shim already rejected these; this closes the direct-agentbox-ctl last-line-of-defense gap.


Summary
Extends the in-box
ghrelay proxy (host runs the authenticatedgh; the box never sees a token) with three capabilities agents frequently need, following the existing five-layergh prpattern (bash shim → ctl → relay allowlist → docker + cloud dispatch).gh pr diff/gh pr checks— read-only additions to the existinggh.pr.*family (no prompt). Branch-injected likegh pr view.gh run list / view / rerun— newgh.run.*family.list/vieware silent reads;rerunre-triggers CI and is gated by the host confirm prompt (+ cloudAGENTBOX_GH_NO_SUBno-subscriber handling).gh run watchis deliberately not proxied (it blocks until CI finishes, which doesn't fit the buffered request/response model) — the shim rejects it with a pointer togh run view.gh api— restricted to an allowlist of endpoint patterns (GH_API_ALLOWED_ENDPOINTS, seeded withrepos/:owner/:repo/pulls/:number/comments, designed to grow). Mutating calls are rejected three ways: at the shim, and server-side viarefuseGhApiWrite(catches-X/--methodnon-GET and the field flags that auto-POST) + the endpoint allowlist.Both dispatch paths updated — docker (
server.ts) and cloud (host-actions.ts) — per the "fix across all providers" convention.Also includes a host-CLI fix:
agentbox git prbuilds its subcommands by iteratingGH_PR_OPS, sodiff/checkswere added toPR_OP_DESCRIPTIONS(otherwise commander's.description(undefined)acts as a getter and the CLI crashes at startup).Scope decisions (confirmed)
gh run watch;gh apiGET-only to start; in-box surface only (no host-sideagentbox gh run/api <box>convenience commands — these ops are read-mostly).Help grouping cleanup
Second commit folds the orphan top-level commands (
git,vercel,doctor) into the Advanced group inagentbox --help, removing the fail-soft "Other" section. The help drift test'sbuildProgram()was missing those three (which is why the drift went unnoticed) — now registered so the "no Other group" guard actually covers them.Test plan
pnpm buildgreen;pnpm lintclean;tsc --noEmit(apps/cli) clean.gh.test.ts(run ops, api endpoint + write guards),host-actions.test.tsrouting, ctlgh-and-shims.test.ts(shim branch-injection / rejection cases).node apps/cli/dist/index.jsloads;git pr --helplistsdiff/checks;--helpshows no "Other" group.gh authon the host (docker + a cloud provider) — not yet run.🤖 Generated with Claude Code
Note
Medium Risk
Expands the GitHub CLI proxy (including CI rerun prompts) but keeps mutations gated and gh api narrowly allowlisted with write guards at shim and relay.
Overview
Extends the host-relayed
ghproxy (box shim →agentbox-ctl→ relay → hostgh) so agents can inspect PRs and CI without host tokens in the box.PR ops: Adds read-only
gh pr diffandgh pr checks(no confirm prompt), with the same branch auto-injection asgh pr view. Hostagentbox git prpicks up descriptions for these ops so Commander does not crash when iteratingGH_PR_OPS.Actions runs: New
gh.run.list/view/rerunRPC family;list/vieware silent reads,rerunis write-gated by the host confirm prompt (cloud path uses sharedcloudWriteConfirm/AGENTBOX_GH_NO_SUB).gh run watchis intentionally not proxied (blocking); the shim errors and points atgh run view.REST: Adds read-only
gh apiwith a small endpoint allowlist (initially PR pull-request comments) plusrefuseGhApiWrite(non-GET methods and field flags that auto-POST) enforced in the shim and relay. Dockerserver.tsand cloudhost-actions.tsboth dispatch the new RPCs.CLI help: Moves
git,doctor, andvercelinto the Advanced help group and registers them in the help drift test so the Other bucket stays empty.Reviewed by Cursor Bugbot for commit d38cde7. Configure here.