Skip to content

Validate localhost URL rewrites and package arguments - #75707

Merged
pelikhan merged 2 commits into
mainfrom
copilot/fix-gradershell-redirect-check
Nov 7, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/fix-gradershell-redirect-check

Conversation

Copilot AI commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Prefix-based URL matching could treat lookalike hosts as localhost, and pip/uv package operands lacked an option terminator.

  • URL rewriting: Parse URLs and rewrite only HTTP(S) URLs with an exact localhost or 127.0.0.1 host. Preserve other URLs unchanged.
  • Package arguments: Retain PyPI-name validation and place the package operand after --:
pip index versions --pre -- requests
uv pip show --no-cache -- requests

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix gradershell redirect validation and pip command arguments Validate localhost URL rewrites and package arguments Nov 7, 2026
Copilot AI requested a review from gh-aw-bot November 7, 2026 16:47
@pelikhan
pelikhan marked this pull request as ready for review November 7, 2026 17:34
Copilot AI dynamic review requested due to automatic review settings November 7, 2026 17:34
@pelikhan
pelikhan merged commit 1f4083e into main Nov 7, 2026
58 checks passed
@pelikhan
pelikhan deleted the copilot/fix-gradershell-redirect-check branch November 7, 2026 17:34
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

Generated from Test Quality Sentinel · routed: gpt56 max · ~1 AIC · ⌖ ~2 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ 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: reported_no_action

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.

Generated from Design Decision Gate 🏗️ · routed: opus55 medium · ~11 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated from Ponytail Reviewer · routed: gpt56 max · ~3 AIC · ⌖ ~1 AIC · ⊞ 118 · ◷

Generated by Ponytail Reviewer for #75707

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_no_action

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.

Generated from PR Specification Reviewer · gpt56 · ~1 AIC · ⌖ ~1 AIC · ⊞ 1.7K · ◷

Generated by PR Specification Reviewer for #75707

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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)

Comment on lines +42 to +44
parsedURL, err := url.Parse(rawURL)
if err != nil || (!strings.EqualFold(parsedURL.Scheme, "http") && !strings.EqualFold(parsedURL.Scheme, "https")) {
return rawURL
Comment on lines +49 to +55
port := parsedURL.Port()
if port == "" {
parsedURL.Host = "host.docker.internal"
} else {
parsedURL.Host = net.JoinHostPort("host.docker.internal", port)
}
newURL := parsedURL.String()
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[AW Top 10] 07 Fix gradershell redirect check and pip command args

4 participants