mirror of
https://github.com/shareAI-lab/analysis_claude_code.git
synced 2026-08-06 12:03:37 +08:00
fix: add missing "> /dev/" dangerous command check in s09/s10/s11
s09_agent_teams.py, s10_team_protocols.py, and s11_autonomous_agents.py were missing the "> /dev/" entry in their dangerous command blocklist. This is present in s01, s06, s12, and s_full but was dropped when s09-s11 were written, creating a security regression where commands like `echo y > /dev/sda` could bypass the blocklist.
This commit is contained in:
@@ -260,7 +260,7 @@ def _safe_path(p: str) -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def _run_bash(command: str) -> str:
|
def _run_bash(command: str) -> str:
|
||||||
dangerous = ["rm -rf /", "sudo", "shutdown", "reboot"]
|
dangerous = ["rm -rf /", "sudo", "shutdown", "reboot", "> /dev/"]
|
||||||
if any(d in command for d in dangerous):
|
if any(d in command for d in dangerous):
|
||||||
return "Error: Dangerous command blocked"
|
return "Error: Dangerous command blocked"
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ def _safe_path(p: str) -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def _run_bash(command: str) -> str:
|
def _run_bash(command: str) -> str:
|
||||||
dangerous = ["rm -rf /", "sudo", "shutdown", "reboot"]
|
dangerous = ["rm -rf /", "sudo", "shutdown", "reboot", "> /dev/"]
|
||||||
if any(d in command for d in dangerous):
|
if any(d in command for d in dangerous):
|
||||||
return "Error: Dangerous command blocked"
|
return "Error: Dangerous command blocked"
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -389,7 +389,7 @@ def _safe_path(p: str) -> Path:
|
|||||||
|
|
||||||
|
|
||||||
def _run_bash(command: str) -> str:
|
def _run_bash(command: str) -> str:
|
||||||
dangerous = ["rm -rf /", "sudo", "shutdown", "reboot"]
|
dangerous = ["rm -rf /", "sudo", "shutdown", "reboot", "> /dev/"]
|
||||||
if any(d in command for d in dangerous):
|
if any(d in command for d in dangerous):
|
||||||
return "Error: Dangerous command blocked"
|
return "Error: Dangerous command blocked"
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user