Skip to content

Commit f1c4789

Browse files
fix: V-001 security vulnerability
Automated security fix generated by Orbis Security AI
1 parent 4b95969 commit f1c4789

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

skills/agent-builder/scripts/init_agent.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from anthropic import Anthropic
3030
from dotenv import load_dotenv
3131
import subprocess
32+
import shlex
3233
import os
3334
3435
load_dotenv()
@@ -63,7 +64,7 @@ def run(prompt, history=[]):
6364
if b.type == "tool_use":
6465
print(f"> {{b.input['command']}}")
6566
try:
66-
out = subprocess.run(b.input["command"], shell=True, capture_output=True, text=True, timeout=60)
67+
out = subprocess.run(shlex.split(b.input["command"]), shell=False, capture_output=True, text=True, timeout=60)
6768
output = (out.stdout + out.stderr).strip() or "(empty)"
6869
except Exception as e:
6970
output = f"Error: {{e}}"
@@ -89,6 +90,7 @@ def run(prompt, history=[]):
8990
from dotenv import load_dotenv
9091
from pathlib import Path
9192
import subprocess
93+
import shlex
9294
import os
9395
9496
load_dotenv()
@@ -133,7 +135,7 @@ def execute(name: str, args: dict) -> str:
133135
if any(d in args["command"] for d in dangerous):
134136
return "Error: Dangerous command blocked"
135137
try:
136-
r = subprocess.run(args["command"], shell=True, cwd=WORKDIR, capture_output=True, text=True, timeout=60)
138+
r = subprocess.run(shlex.split(args["command"]), shell=False, cwd=WORKDIR, capture_output=True, text=True, timeout=60)
137139
return (r.stdout + r.stderr).strip()[:50000] or "(empty)"
138140
except subprocess.TimeoutExpired:
139141
return "Error: Timeout (60s)"

0 commit comments

Comments
 (0)