Skip to content

Validate UV executable path before package lookup - #76157

Open
gh-aw-bot with Copilot wants to merge 6 commits into
mainfrom
copilot/sighthound-security-findings-again
Open

gh-aw-bot with Copilot wants to merge 6 commits into
mainfrom
copilot/sighthound-security-findings-again

Conversation

Copilot AI commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Reported findings covered pip/uv package lookups and Pi sub-agent execution. This change closes the UV helper’s executable-path validation gap while preserving the existing argument and input protections.

  • UV lookup: Validate the executable path at the invocation boundary; reject invalid paths before execution.
  • Argument safety: Keep fixed arguments and the option terminator:
    exec.Command(validatedUvPath, "pip", "show", "--no-cache", "--", pkgName)
  • Other reported paths: Pip already validates its executable and package names. Pi sub-agent dispatch uses shell: false and sends task text through stdin.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix potential command injection vulnerabilities in workflow Validate UV executable path before package lookup Nov 9, 2026
Copilot AI requested a review from gh-aw-bot November 9, 2026 06:10
@pelikhan
pelikhan marked this pull request as ready for review November 9, 2026 06:11
Copilot AI auto review requested due to automatic review settings November 9, 2026 06:11
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR Specification Reviewer was cancelled. Please review the logs for details.

PR Specification Reviewer

Outcome: unconfirmed

The agent emitted a no-op output, but successful task completion is unconfirmed.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

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

Generated by PR Specification Reviewer for #76157

@github-actions

github-actions Bot commented Nov 9, 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: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 9, 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 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

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: gpt61 medium · ~3 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76157

@github-actions

github-actions Bot commented Nov 9, 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 9, 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.

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

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: haiku55 xhigh · ~1 AIC · ◇ ~1 AIC · ⊞ 8.6K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-09T06:14:17Z
review_event: COMMENT
top_themes: [regression-test-validity]
files_reviewed: [pkg/workflow/argument_injection_test.go, pkg/workflow/pip_validation.go]
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot 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.

Found one blocking test-quality issue: the new executable-path regression test passes even without the production fix because its fake uv is not on PATH. The inline comment explains the required correction. Other candidate concerns were either pre-existing behavior or covered by existing tests.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

Comment thread pkg/workflow/argument_injection_test.go Outdated
}
t.Setenv("GH_AW_TEST_UV_ARGS_FILE", argsFile)

err := NewCompiler().validateUvPackagesWithExecutable([]string{"requests"}, "uv")

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.

This regression test does not actually exercise the unpatched behavior: the fake executable is written under tempDir, but tempDir is never added to PATH, while the call passes the relative name "uv". Before this change, exec.Command("uv", ...) would simply fail to start and leave argsFile absent, so the os.IsNotExist assertion would still pass. Add t.Setenv("PATH", tempDir+string(os.PathListSeparator)+os.Getenv("PATH")) (or assert the specific validation error) so the test fails without the fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the regression test to change into the fixture directory and invoke ./uv, so the fake executable runs if the path guard is removed. Commit: daa618b.

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

The regression test can falsely pass without the path-validation guard because the fake uv executable is not on PATH, allowing command lookup failure to mask the regression.

1 open issue
What changed in this PR

This PR closes the UV executable-path validation gap in gh-aw’s compiler package lookup while preserving existing package-name checks and argument protections.

Changes:

  • Validate the UV executable path before execution and use the validated result.
  • Add a regression test for rejecting relative executable paths before execution.
File Description
pkg/​workflow/​pip_validation.go Validates the UV executable path while retaining fixed arguments and the option terminator.
pkg/​workflow/​argument_injection_test.go Adds a fake-UV test intended to verify rejection before execution.

Review effort: Max (auto)

if err := os.WriteFile(uvPath, []byte(script), 0o755); err != nil {
t.Fatalf("failed to write fake uv executable: %v", err)
}
t.Setenv("GH_AW_TEST_UV_ARGS_FILE", argsFile)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the regression test to change into the fixture directory and invoke ./uv, so the fake executable runs if the path guard is removed. Commit: daa618b.

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

One or more custom setup steps configured for this repository failed during this Copilot code review run:

Install development dependencies

Setup steps run before each review. If the review above is missing context, or no review was posted at all, the failing step above may be the cause. See the workflow run for failure details, fix your setup steps configuration, and re-request a review.

Note

You can configure setup steps for Copilot code review separately from Copilot cloud agent with a copilot-code-review.yml file. Read the docs for details.

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /tdd and /diagnosing-bugs. The production change is sound and I verified it. The new regression test is vacuous, so requesting changes.

📋 Key Themes & Highlights

Key Themes

  • Regression test does not guard the fix: TestValidateUvPackagesWithExecutable_RejectsUnvalidatedExecutablePath passes the bare name uv, not the fake executable, so it passes on the pre-fix code too.

Verification

  • go test ./pkg/workflow -run TestValidateUvPackages passes.
  • A probe that runs a relative ./uv fails on the pre-fix code and is rejected with the fix. This confirms the production change works. The probe was temporary and has been removed.

Positive Highlights

  • ✅ Validating at the invocation boundary, and passing the canonical path returned by ValidateExecutablePath to exec.Command, is the right defence-in-depth.
  • ✅ Fixed arguments and the -- option terminator are preserved.

@copilot please address the review comment above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.3K
Comment /matt to run again

Comment thread pkg/workflow/argument_injection_test.go Outdated
}
t.Setenv("GH_AW_TEST_UV_ARGS_FILE", argsFile)

err := NewCompiler().validateUvPackagesWithExecutable([]string{"requests"}, "uv")

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.

[/tdd] [/diagnosing-bugs] This regression test does not exercise the fix: it passes the bare name "uv" instead of the fake executable uvPath. The fake script is never run, so the test also passes against the pre-fix pip_validation.go. I confirmed this by reverting the pip_validation.go hunk and re-running it.

💡 Suggested change

Chdir into the temp dir and pass a relative path, so the new check is what rejects it:

t.Setenv("GH_AW_TEST_UV_ARGS_FILE", argsFile)
t.Chdir(tempDir)

err := NewCompiler().validateUvPackagesWithExecutable([]string{"requests"}, "./uv")

With this change the test fails on the pre-fix code (the relative ./uv runs and writes the args file) and passes with the fix.

@copilot please address this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated the regression test to change into the fixture directory and invoke ./uv; the unpatched implementation now runs the fake binary and makes the test fail. Commit: daa618b.

@pelikhan

pelikhan commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill, fix ci failures

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/argument_injection_test.go:603): address unresolved feedback - Review comment
  3. Review (pkg/workflow/argument_injection_test.go:603): address unresolved feedback - Review comment
  4. Fix failing check lint-go-golangci (0) (FAILURE): Check run.
  5. Fix failing check lint-go-golangci (2) (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "0e4bb063494678e1e630b6ea430022d828b10f1d",
  "kind": "requested",
  "schema_version": "1",
  "state": "60092bb45253b9138cc34d7c4de4d17de243a234c7e742e0c8979be14be5f165",
  "work": [
    "1027833686a7050a64d8bfe136387980a34b94be7e9b120f51fd825652824672",
    "1d1e0bc12378a092e2b8f34e7e1aa1da733b42f3805a79c1e024be01117338c1",
    "20c5fb9e2e37672daf5b7271dae9c95ff59f03cf41d0cde5ac7e2acc9456d2d1",
    "b3128910de978c3d2b1a79eae53581873ac33f4899c1fe9917d2fc310d7654ab"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~5 AIC · ⌖ ~14 AIC · ⊞ 1.3K · ◷
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

One or more custom setup steps configured for this repository failed during this Copilot code review run:

The setup failed while downloading golangci-lint v2.15.0 from GitHub Releases: HTTP 504 after three retries. Local make lint and the final impacted-test gate pass, so this is a transient download failure rather than a setup configuration defect.

@copilot run pr-finisher skill, fix ci failures

The regression test now executes its fake ./uv from the fixture directory; focused tests, make fmt, make lint, and make agent-report-progress passed. The reported golangci-lint failures were GitHub Releases HTTP 504s; CI on the pushed head still needs a maintainer re-trigger.

…curity-findings-again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged the latest main into the PR branch as requested; merge commit 5af9005 preserves both parents. make lint and make agent-report-progress passed after the merge. The earlier failed lint jobs were caused by GitHub Releases HTTP 504s downloading golangci-lint v2.15.0; CI on this pushed head still needs a maintainer re-trigger.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

Warning

Threat detection engine error

Threat detection could not complete its analysis due to a tooling error. This is not a security finding.

What happened

The threat detection engine failed to produce results.

Review the workflow run logs to troubleshoot the error.

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Fix failing check github-advanced-security (FAILURE): Check run.
  3. Fix failing check impacted-go-tests (FAILURE): Check run.
  4. Fix failing check lint-go-golangci (2) (FAILURE): Check run.

Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering.

Structured data
{
  "completed_task": 0,
  "head": "5af9005241ceaffac282967d268861298f4a536e",
  "kind": "requested",
  "schema_version": "1",
  "state": "ba2923f5de66d50bf3e61030d891f8b6f05e94642d405686219b4647b6ccbeed",
  "work": [
    "20c5fb9e2e37672daf5b7271dae9c95ff59f03cf41d0cde5ac7e2acc9456d2d1",
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac",
    "960a6fe297781e0f1e1c8c03fa3740110735e1332e99a040b5aa7b1b6d14a3f2"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~5 AIC · ⊞ 1.3K · ◷
Comment /souschef to run again

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>

Copilot AI commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill, fix ci failures

Fixed the impacted Go test by updating its expected step name to match the workflow source; make fmt, make lint, targeted tests, and make agent-report-progress pass. The fix is in commit fcedaeb. The other reported failures were runner-side Node absence and a transient golangci-lint download timeout; CI needs a maintainer re-trigger.

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged latest main (already current), corrected the semantic-refactor test assertion, and passed make fmt, make lint, targeted tests, and make agent-report-progress. Commit: fcedaeb. The earlier impacted-test failure is fixed; Advanced Security failed because the runner lacked Node, and the lint download hit HTTP 504. CI needs a maintainer re-trigger.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

🍳 The prep is done, but CI needs another taste test. Copilot's assigned task has finished; these checks are still failing: Completed task

Flagging the remaining blockers for maintainer investigation, not starting another copy of the same task.

Structured data
{
  "completed_task": 42584642554,
  "head": "fcedaeb4adbff9a7ac7ec97e61b40e3f44ea7b73",
  "kind": "ci-follow-up",
  "schema_version": "1",
  "state": "e878ea6f5825173f878cdc50c034fae541ab21afcda61e90b2e02b064519321f",
  "work": [
    "42e5d572d9d75b7168fe7d0aeda0717cc07e65ed240f6d299e6fec661214f1ac"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~4 AIC · ⌖ ~14 AIC · ⊞ 1.3K · ◷
Comment /souschef to run again

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[sighthound] Security findings in github/gh-aw

4 participants