Repository navigation
Harden Pi sub-agent invocation validation - #76422
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.
|
|
✅ 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.
|
|
✅ 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.
|
|
✅ 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.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 === 2plusObject.hasOwnchecks reject extra fields likecommand. 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 throughexecute(). - Key enumeration:
Object.keysignores non-enumerable and symbol keys. Tool calls arrive as JSON, so this is defense-in-depth.Reflect.ownKeyscloses it.
Positive Highlights
- ✅ The
shell: falseargument-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/uvfindings inpkg/workflow/pip_validation.goare already mitigated there byvalidatePipPackageName,--, 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
There was a problem hiding this comment.
🟡 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
agentandtaskfields before delegation. - Adds a rejection case for an unexpected
commandfield.
| 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 => { |
|
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.
|
1 similar comment
|
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.
|
|
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.
|
|
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.
|
|
🎉 This pull request is included in a new release. Release: |

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
agentandtaskfields, rejecting extra fields that could be mistaken for execution controls. The task is passed via stdin; the child is launched with an argument array andshell: false.pip/uv command validation: Preserve existing package-name and executable-path checks, fixed arguments, and the
--separator.