fix(sdk): eliminate shell injection vectors in scheduler and state backend#916
fix(sdk): eliminate shell injection vectors in scheduler and state backend#916tamirdresher merged 1 commit intodevfrom
Conversation
🟡 Impact Analysis — PR #916Risk tier: 🟡 MEDIUM 📊 Summary
🎯 Risk Factors
📦 Modules Affectedroot (1 file)
squad-sdk (3 files)
tests (2 files)
|
🏗️ Architectural Review
Automated architectural review — informational only. |
893201e to
0db36cc
Compare
🔍 Squad Review — Kaylee (Engineering)
Verdict: ✅ Ready to merge Review by Squad AI team (Kaylee — Engineering) · requested by Dina Berry |
🏗️ Flight — Architecture ReviewVerdict: ✅ APPROVE Findings
Module Boundary Check
RecommendationMerge with priority. This is a P0 security fix. The |
🧪 FIDO — Quality ReviewVerdict: ✅ APPROVE Test Coverage
Edge Cases / Risks
CI Impact
RecommendationApprove. This is critical security hardening. The execSync→execFileSync migration eliminates an entire class of injection vectors. Test coverage on the security boundaries is thorough. The naive script ref splitting is a minor edge case worth documenting but not blocking. |
🔒 RETRO — Security ReviewVerdict: ✅ APPROVE — Strong security fix Security FindingsThis PR correctly eliminates all identified shell injection vectors. Detailed analysis below. 1. Scheduler (
|
There was a problem hiding this comment.
Pull request overview
Hardens the scheduler and git-native state backends against shell injection by removing shell-interpreted command execution paths and adding input validation with targeted security tests.
Changes:
- Replaces scheduler script execution with
execFileSyncand addsvalidateTaskRef()(also enforced at manifest-parse time). - Refactors state backend git helpers to use
execFileSyncwith explicit argv arrays and introducesvalidateStateKey()/normalizeKey()validation. - Adds security-focused tests covering common injection vectors and key/path validation.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
packages/squad-sdk/src/runtime/scheduler.ts |
Adds validateTaskRef() + switches script execution to execFileSync with argv handling. |
packages/squad-sdk/src/state-backend.ts |
Replaces shell execution with execFileSync, refactors git helpers to argv arrays, and validates keys to prevent traversal/plumbing injection. |
packages/squad-sdk/src/index.ts |
Re-exports validateStateKey() from the SDK entrypoint. |
test/scheduler.test.ts |
Updates scheduler tests for the new execution model and adds injection-prevention coverage. |
test/state-backend.test.ts |
Adds validation and backend-level rejection tests for dangerous state keys. |
.changeset/shell-injection-fixes.md |
Records the SDK patch release notes for the security hardening. |
|
✅ CI validation passed on fork: diberry#140 — 7/7 checks green |
…ckend (#916) Co-authored-by: Dina Berry <diberry@users.noreply.github.com>
|
Closed by #theSquadsquad triage — verified fixed in v0.9.4 (PR #925 merged). |
Addresses #895 P0-1 (scheduler execSync) and P0-2 (state backend execSync).
Changes:
Working as EECOM (Core Dev)
Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com