Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
Address code review feedback: improve function naming and consolidate patterns
copilot-swe-agent[bot]56d301de3e6b
diff --git a/SECURITY.md b/SECURITY.mdindex 7f98faf54..193a99371 100644--- a/SECURITY.md+++ b/SECURITY.md@@ -5,7 +5,7 @@If you discover a security vulnerability in nanobot, please report it by:1. **DO NOT** open a public GitHub issue-2. Email the maintainers at [[email protected]] or create a private security advisory on GitHub+2. Create a private security advisory on GitHub or contact the repository maintainers3. Include:- Description of the vulnerability- Steps to reproducediff --git a/nanobot/agent/tools/shell.py b/nanobot/agent/tools/shell.pyindex 5d1744825..5319c57ce 100644--- a/nanobot/agent/tools/shell.py+++ b/nanobot/agent/tools/shell.py@@ -10,8 +10,7 @@ from nanobot.agent.tools.base import Tool# List of potentially dangerous command patternsDANGEROUS_PATTERNS = [- r'rm\s+-rf\s+/\s*$', # rm -rf / (at root only)- r'rm\s+-rf\s+/(?![\w/])', # rm -rf / followed by whitespace or end+ r'rm\s+-rf\s+/(?:\s|$)', # rm -rf / (at root, followed by space or end)r':\(\)\{\s*:\|:&\s*\};:', # fork bombr'mkfs\.', # format filesystemr'dd\s+if=.*\s+of=/dev/(sd|hd)', # overwrite disk@@ -19,7 +18,7 @@ DANGEROUS_PATTERNS = []-def _is_dangerous_command(command: str) -> tuple[bool, str | None]:+def validate_command_safety(command: str) -> tuple[bool, str | None]:"""Check if a command contains dangerous patterns.@@ -66,7 +65,7 @@ class ExecTool(Tool):async def execute(self, command: str, working_dir: str | None = None, **kwargs: Any) -> str:# Check for dangerous command patterns- is_dangerous, warning = _is_dangerous_command(command)+ is_dangerous, warning = validate_command_safety(command)if is_dangerous:return f"Error: Refusing to execute dangerous command. {warning}"