Skip to content

Use a fixed executable for Pi sub-agent launches - #77474

Merged
pelikhan merged 7 commits into
mainfrom
copilot/sighthound-security-findings
Nov 13, 2026
Merged

pelikhan merged 7 commits into
mainfrom
copilot/sighthound-security-findings

Conversation

Copilot AI commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

The scan flagged command-injection risks in pip/uv validation and Pi sub-agent execution. Pi sub-agents now launch a fixed executable; the pip/uv paths already validate executable paths and package names, pass arguments directly, and use --.

  • Pi sub-agents: Ignore the environment-provided executable override. Keep arguments separate, disable shell execution, and send task text through stdin.
    launch("pi", args, { shell: false, ... });
  • Regression coverage: Verify the fixed executable is used even when an override is set, and shell-like task text remains stdin data.

Copilot AI changed the title [WIP] Fix command injection vulnerabilities in pip_validation and js extension Use a fixed executable for Pi sub-agent launches Nov 13, 2026
Copilot AI requested a review from gh-aw-bot November 13, 2026 14:47
@pelikhan
pelikhan marked this pull request as ready for review November 13, 2026 17:53
Copilot AI adaptive review requested due to automatic review settings November 13, 2026 17:53
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ PR Code Quality Reviewer failed to deliver outputs during code quality review.

PR Code Quality Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

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

Generated from PR Code Quality Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR Specification Reviewer failed to deliver outputs. Please review the logs for details.

PR Specification Reviewer

Outcome: reported_action

The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken.

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 AIC · ⊞ 1.7K · ◷

Generated by PR Specification Reviewer for #77474

@github-actions

github-actions Bot commented Nov 13, 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: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 182 · ◷

Generated by Ponytail Reviewer for #77474

@github-actions

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

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

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

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-13T17:57:28Z
review_event: REQUEST_CHANGES
top_themes: [PATH-controlled executable, custom Pi command regression]
files_reviewed: [actions/setup/js/pi_subagent_extension.cjs, actions/setup/js/pi_subagent_extension.test.cjs]
comment_count: 2
History

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 two blocking issues on the changed launch line: the bare pi name remains PATH-controlled, so the claimed executable hardening is incomplete; and ignoring GH_AW_PI_COMMAND breaks consistency with the parent runtime and custom Pi configurations. Inline comments provide the impact and remediation.

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

);
return await new Promise((resolve, reject) => {
const child = launch(process.env.GH_AW_PI_COMMAND || "pi", subagentArgs(agent, promptPath), {
const child = launch("pi", subagentArgs(agent, promptPath), {

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 changes delegated execution to ignore the configured GH_AW_PI_COMMAND, even though the parent runtime still uses that setting for its verified/custom Pi binary. Workflows using a custom command will now silently run a different executable for sub-agents (or fail if pi is not on PATH), creating inconsistent behavior between parent and child. Please preserve the configured command via a trusted/validated resolution rather than dropping the setting outright.

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.

Sub-agents now use the canonical absolute path resolved from the configured Pi command, preserving custom executables. Fixed in 5fc78d5f.

);
return await new Promise((resolve, reject) => {
const child = launch(process.env.GH_AW_PI_COMMAND || "pi", subagentArgs(agent, promptPath), {
const child = launch("pi", subagentArgs(agent, promptPath), {

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.

spawn("pi", ...) still resolves the executable through PATH; removing GH_AW_PI_COMMAND therefore does not make the binary trusted. A workflow or prior step can prepend a writable directory containing a malicious pi, and this child will execute it with the inherited environment. Please resolve the managed Pi binary to an absolute, validated path during setup and spawn that path (or otherwise explicitly constrain PATH) so this change actually closes the command-selection vulnerability.

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.

The extension resolves Pi once to its real absolute path during setup and captures it for child launches, so later PATH changes cannot redirect sub-agents. Fixed in 5fc78d5f.

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

Sub-agent launches bypass the supported GH_AW_PI_COMMAND setting, breaking configurations with custom executables outside PATH and causing the attribution test to fail or invoke the real CLI.

2 open issues
What changed in this PR

This PR hardens executable selection for gh-aw’s Pi sub-agents while preserving separate arguments, disabled shell execution, and task input through stdin.

Changes:

  • Launch sub-agents with the fixed pi command instead of GH_AW_PI_COMMAND.
  • Update regression tests to verify overrides are ignored and locate child-process fixtures through PATH.
File Description
actions/​setup/​js/​pi_subagent_extension.test.cjs Checks fixed-command behavior and migrates executable fixtures to PATH.
actions/​setup/​js/​pi_subagent_extension.cjs Replaces the environment-selected executable with literal pi.

Review effort: Max (dynamic)

);
return await new Promise((resolve, reject) => {
const child = launch(process.env.GH_AW_PI_COMMAND || "pi", subagentArgs(agent, promptPath), {
const child = launch("pi", subagentArgs(agent, promptPath), {

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.

Migrated the attribution fixture to a pi executable on a stubbed PATH; the real-process attribution test now passes. Fixed in 5fc78d5f.

);
return await new Promise((resolve, reject) => {
const child = launch(process.env.GH_AW_PI_COMMAND || "pi", subagentArgs(agent, promptPath), {
const child = launch("pi", subagentArgs(agent, promptPath), {

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.

The configured Pi executable is resolved to an absolute path and captured for sub-agent launches, preserving custom commands outside PATH. Fixed in 5fc78d5f.

@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 /codebase-design and /diagnosing-bugs. The security direction is right: the fixed "pi" plus shell: false and stdin task delivery remove the override from the sub-agent launch path. Requesting changes because the fix has a behavior gap.

📋 Key Themes & Highlights

Key Themes

  • Dropped engine.command for sub-agents: pi_engine_config.go sets GH_AW_PI_COMMAND from engine.command. The parent still honors it, but sub-agents now launch a different pi from PATH. This is inconsistent and undocumented.
  • Test stub left behind: awf_caller_attribution.test.cjs (pi_main_and_subagent_caller_attribution) still stubs GH_AW_PI_COMMAND and calls runPiSubagent. It now runs the real pi from PATH instead of the fake executable, so it will likely fail or hit the wrong binary. I could not run the suite because npm ci is blocked by the sandbox TLS proxy, so this is from static reading.
  • PATH-based tests: the new tests prepend the temp dir to PATH, which still depends on environment resolution. They do not exercise a pinned executable.

Positive Highlights

  • ✅ shell: false and stdin-only task text are preserved and well covered by the shell-injection test.
  • ✅ The attacker-override test asserts the command is exactly pi, which is a clear regression guard.

@copilot please address the review comments above.

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

);
return await new Promise((resolve, reject) => {
const child = launch(process.env.GH_AW_PI_COMMAND || "pi", subagentArgs(agent, promptPath), {
const child = launch("pi", subagentArgs(agent, promptPath), {

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.

[/codebase-design] Sub-agents now ignore GH_AW_PI_COMMAND, which pi_engine_config.go sets from engine.command. The parent Pi process still honors it (pi_runtime.cjs version check, pi_session_export.cjs, pi_agent_core_driver.cjs), so a custom engine command runs the parent but launches a different pi from PATH for sub-agents. Bare-name spawn also resolves through env.PATH, which is still environment-controlled, so the override is moved rather than removed.

💡 Suggested fix

Resolve the executable once in the parent to an absolute path (the same binary pi_runtime.cjs verifies) and pass that path to sub-agent launches, so every Pi launch uses one resolved binary. If the engine.command override should not apply to sub-agents, document that explicitly.

@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.

Added a shared executable resolver used by version verification and captured its absolute result during extension setup, keeping custom commands consistent and immune to later PATH changes. Fixed in 5fc78d5f.

@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 (actions/setup/js/pi_subagent_extension.cjs:76): address unresolved feedback - Review comment
  3. Review (actions/setup/js/pi_subagent_extension.cjs:76): address unresolved feedback - Review comment
  4. Review (actions/setup/js/pi_subagent_extension.cjs:76): address unresolved feedback - Review comment
  5. Fix failing check JS Tests (shard 6/8) (FAILURE): Check run.
  6. Fix failing check JS Tests (shard 6/8) (FAILURE): Check run.
  7. Fix failing check push_ledger_changes (FAILURE): Check run.
  8. Fix failing check push_ledger_changes (FAILURE): Check run.
  9. Fix failing check push_ledger_changes (FAILURE): Check run.
  10. Fix failing check safe_outputs (FAILURE): Check run.
  11. Fix failing check safe_outputs (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": "7d68ca441e84701485188a72ea3d5680f9b87e70",
  "kind": "requested",
  "schema_version": "1",
  "state": "4d7eeff6cfb4addd967d0cb8617e404890327dc2b4776f5e6810e91209ac536d",
  "work": [
    "2ec1c55a56c3bbc3d439b0f0d819e0f964a9c8ea5c8bbe45cc9676c7e7802a18",
    "8bba9b96c07d42363ec8c94b98f4bf3c762909b6960b57b3f39adf250466b253",
    "b942bebdf0eedc235a53ee8a0ac9bb3a4e173ec17b75259a62774ac1c2bcff83",
    "c7cf93e497befdd5e698d00101b0703e4101fe4133d86d433f7c170d07402b7e",
    "d9cc08d9273b4c5b8d8d29ecce0602e2a5a0920d5e3db1a3425b6dbafc01d7bc",
    "e9c493b14202804e3c442e04e4e87c86cb7acc299d04810453dd4707c6770716"
  ],
  "workflow": "pr-sous-chef"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~3 AIC · ⌖ ~2 AIC · ⊞ 6.9K · ◷
Comment /souschef to run again

Copilot AI commented Nov 13, 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 latest main and fixed the Pi executable resolution and attribution-test failure in dc1336a3/5fc78d5f. The final validation gate passed. The ledger publisher failures followed safe-output ledger-schema rejection and a missing transaction artifact; they are unrelated to the Pi changes. CodeQL timed out and its tool instructed me not to retry.

Co-authored-by: gh-aw-bot <[email protected]>
@pelikhan
pelikhan merged commit cd3bdf9 into main Nov 13, 2026
32 checks passed
@pelikhan
pelikhan deleted the copilot/sighthound-security-findings branch November 13, 2026 20:27
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.3.0

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.

[sighthound] Security findings in github/gh-aw

4 participants