Repository navigation
fix(proxy): preserve encoded REST path identity - #16781
Conversation
Construct upstream URLs through net/url so percent-like path segments remain literal and match the identity evaluated by the guard. Add forwarding and end-to-end regression coverage for double-encoded repository paths. Co-authored-by: Copilot App <[email protected]>
🔒 mcpg Read-Only Stress — defaultSurface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Overall: INCONCLUSIVE No write of any kind leaked through either surface. Part A and Part C reads fully succeeded. Part B is INCONCLUSIVE because gh-aw's No artifacts were created, no reactions/stars applied, no issues/comments/branches/files/PRs created.
|
There was a problem hiding this comment.
🔵 Needs a closer look
The shared URL serialization change affects consistency between guard-authorized identities and upstream resource selection across multiple routes, requiring human security review.
No open issues 🎉
What changed in this PR
Preserves encoded REST path identity when forwarding GitHub API requests, keeping upstream repository names consistent with those evaluated by the guard.
Changes:
- Constructs upstream URLs with
net/urlinstead of reparsing concatenated strings. - Preserves GraphQL endpoint routing and query forwarding.
- Adds forwarding and end-to-end regression tests for double-encoded repository paths.
| File | Description |
|---|---|
internal/proxy/proxy.go |
Adds structured URL construction to preserve literal percent-like path segments. |
internal/proxy/handler_test.go |
Verifies guard repository arguments match the forwarded request identity. |
internal/proxy/forward_to_github_test.go |
Adds regression coverage for forwarding percent-like REST segments. |
Review effort: Max (adaptive)
Summary
net/urlinstead of reparsing concatenated path stringsSecurity impact
Prevents a double-encoded REST path from being evaluated by the guard as
%61/%62but forwarded upstream asa/b. This is a defense-in-depth fix for githubnext/gh-aw-security#3611.Validation
make agent-finished