Skip to content

Harden Pi sub-agent invocation validation - #76422

Merged
pelikhan merged 2 commits into
mainfrom
copilot/sighthound-fix-security-findings
Nov 10, 2026
Merged

pelikhan merged 2 commits into
mainfrom
copilot/sighthound-fix-security-findings

Conversation

Copilot AI commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

The reported pip/uv and Pi sub-agent command flows needed review for injection risk. This change tightens runtime validation of Pi tool parameters; the pip/uv paths already validate package names and executable paths and use fixed arguments with --.

  • Pi sub-agent inputs: Require exactly the declared agent and task fields, rejecting extra fields that could be mistaken for execution controls. The task is passed via stdin; the child is launched with an argument array and shell: false.

    { agent: "reader", task: "Read the file" } // accepted
    { agent: "reader", task: "Read the file", command: "/tmp/other" } // rejected
  • pip/uv command validation: Preserve existing package-name and executable-path checks, fixed arguments, and the -- separator.

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix command injection vulnerabilities in pip validation Harden Pi sub-agent invocation validation Nov 10, 2026
Copilot AI requested a review from gh-aw-bot November 10, 2026 06:40
@pelikhan
pelikhan marked this pull request as ready for review November 10, 2026 06:43
Copilot AI adaptive review requested due to automatic review settings November 10, 2026 06:43
@github-actions

github-actions Bot commented Nov 10, 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 10, 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 · ~2 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

Generated by PR Specification Reviewer for #76422

@github-actions

github-actions Bot commented Nov 10, 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.5K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 10, 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 · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76422

@github-actions

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

Review complete: no actionable correctness, security, performance, or maintainability issues found in the changed lines. The strict parameter-shape validation is intentional and covered by the added extra-field regression case.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 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.

Skills-Based Review 🧠

Applied /codebase-design and /tdd to the 12-line change in pi_subagent_extension.cjs. The gate is sound. Two non-blocking suggestions are posted inline.

📋 Key Themes & Highlights

Key Themes

  • Strict parameter shape: The Object.keys(...).length === 2 plus Object.hasOwn checks reject extra fields like command. I checked the edge cases directly in Node. Missing, extra, inherited, and wrong-typed fields are rejected. Valid input is accepted.
  • Test gap on the accept path: The new case covers only rejection. Nothing shows that exactly {agent, task} still succeeds through execute().
  • Key enumeration: Object.keys ignores non-enumerable and symbol keys. Tool calls arrive as JSON, so this is defense-in-depth. Reflect.ownKeys closes it.

Positive Highlights

  • ✅ The shell: false argument-array launch and the stdin-only task path are unchanged and correctly separate untrusted input from argv.
  • ✅ The new rejection case uses the exact payload from the PR description.
  • ✅ The linked Go pip/uv findings in pkg/workflow/pip_validation.go are already mitigated there by validatePipPackageName, --, and fixed arguments. This PR does not need to change them.

Validation Note

Vitest could not run in this environment. npm ci failed on a self-signed certificate from the npm registry, so the test-suite result is unverified. The predicate was checked with a standalone Node script instead.

@copilot please address the review comments above.

Comments that could not be inline-anchored

actions/setup/js/pi_subagent_extension.cjs:214

**[/codebase-design]** `Object.keys(params).length` counts only own enumerable string keys, so an extra non-enumerable or symbol-keyed property would still pass the "exactly `agent` and `task`" gate. JSON tool calls cannot produce those today, so this is defense-in-depth, but `Reflect.ownKeys` makes the check match the stated contract. <details> <summary>💡 Suggested change</summary> ```js Reflect.ownKeys(params).length !== 2 || ``` The `Object.hasOwn` checks on the next lines still r...

actions/setup/js/pi_subagent_extension.test.cjs:77

**[/tdd]** Only the rejection side is covered. Nothing exercises the accept path through `execute()`, because the success test calls `runPiSubagent` directly. The new gate changes what is accepted, so add a positive case: `execute` with exactly `{ agent: "reader", task: "Read." }` should reach the launcher and resolve. Stub `spawn` (for example with `vi.mock("node:child_process")`) so no real `pi` process starts. <details> <summary>💡 Suggested test name</summary> `accepts exactly the declared...

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

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 new guard lacks a successful tool.execute test with exactly { agent, task }, leaving valid delegation acceptance unverified.

1 open issue
What changed in this PR

Tightens Pi sub-agent tool validation in the workflow setup runtime to match its declared input schema, addressing the Pi portion of #76413. Existing pip/uv validation remains unchanged.

Changes:

  • Requires exactly the own agent and task fields before delegation.
  • Adds a rejection case for an unexpected command field.
File Description
actions/​setup/​js/​pi_subagent_extension.test.cjs Adds extra-field rejection coverage.
actions/​setup/​js/​pi_subagent_extension.cjs Enforces parameter count and required own properties.

Review effort: Max (auto)

});

it.each([null, [], { agent: "unknown", task: "Read." }, { agent: "reader", task: " " }])("rejects malformed or undeclared invocation parameters: %j", async params => {
it.each([null, [], { agent: "unknown", task: "Read." }, { agent: "reader", task: " " }, { agent: "reader", task: "Read.", command: "/tmp/attacker" }])("rejects malformed or undeclared invocation parameters: %j", async params => {
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: high | Score: 68/100 (impact 36 + urgency 18 + quality 14) | Recommended action: fast_track | Notes: hardens Pi sub-agent invocation validation; security-sensitive validation fix affecting agent invocation boundaries.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: high | Score: 68/100 (impact 36 + urgency 18 + quality 14) | Recommended action: fast_track | Notes: hardens Pi sub-agent invocation validation; security-sensitive validation fix affecting agent invocation boundaries.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: high | Score: 68/100 (impact 36 + urgency 18 + quality 14) | Recommended action: fast_track | Notes: tightens Pi sub-agent invocation validation; security-sensitive validation fix.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

@github-actions

Copy link
Copy Markdown
Contributor

Category: bug | Risk: high | Score: 68/100 (impact 36 + urgency 18 + quality 14) | Recommended action: fast_track | Notes: tightens Pi sub-agent invocation validation; security-sensitive validation fix.

Generated by 🔧 PR Triage Agent · copilot · mai11 · ~9 AIC · ⌖ ~2 AIC · ⊞ 15.8K · ◷

@pelikhan
pelikhan merged commit 25628f3 into main Nov 10, 2026
112 checks passed
@pelikhan
pelikhan deleted the copilot/sighthound-fix-security-findings branch November 10, 2026 15:53
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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