Repository navigation
Validate localhost URL rewrites and package arguments - #75707
Conversation
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: 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.
|
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft. Design Decision Gate 🏗️Outcome: 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: 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.
|
|
✅ PR Code Quality Reviewer completed the code quality review.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: 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.
|
There was a problem hiding this comment.
🟡 Changes recommended
URL rewriting fails for deferred ports and percent-encodes path expressions, causing incorrect container routing and requests to literal encoded paths.
2 open issues
What changed in this PR
This PR hardens gh-aw’s MCP URL rewriting and Python package command arguments, addressing the validation concerns in #73137.
Changes:
- Uses URL parsing to restrict Docker hostname rewrites to HTTP(S) URLs with exact localhost hosts.
- Adds
--before pip and uv package operands while retaining package-name validation. - Adds regression coverage for lookalike hosts, unsupported schemes, and dash-prefixed package rejection.
| File | Description |
|---|---|
pkg/workflow/pip_validation.go |
Adds option terminators to pip and uv commands. |
pkg/workflow/mcp_renderer_factory.go |
Replaces prefix matching with parsed scheme and hostname checks. |
pkg/workflow/mcp_config_shared_test.go |
Tests that lookalike hosts and unsupported schemes remain unchanged. |
pkg/workflow/argument_injection_test.go |
Updates argument assertions and tests rejection before uv execution. |
Review effort: Balanced (auto)
| parsedURL, err := url.Parse(rawURL) | ||
| if err != nil || (!strings.EqualFold(parsedURL.Scheme, "http") && !strings.EqualFold(parsedURL.Scheme, "https")) { | ||
| return rawURL |
| port := parsedURL.Port() | ||
| if port == "" { | ||
| parsedURL.Host = "host.docker.internal" | ||
| } else { | ||
| parsedURL.Host = net.JoinHostPort("host.docker.internal", port) | ||
| } | ||
| newURL := parsedURL.String() |
|
🎉 This pull request is included in a new release. Release: |

Prefix-based URL matching could treat lookalike hosts as localhost, and pip/uv package operands lacked an option terminator.
localhostor127.0.0.1host. Preserve other URLs unchanged.--: