This document outlines the security measures implemented in the Groq Anthropic Tool Proxy to ensure safe execution of tools, particularly those that interact with the file system or execute commands.
The core of our security model is a Virtual File System (VFS) that provides isolation and sandboxing for all file operations.
-
Path Isolation: All file operations are constrained to a specific base directory, preventing access to sensitive system files.
-
Path Sanitization: All paths are sanitized to prevent directory traversal attacks using
..or other escape sequences. -
Consistent Working Directory: A virtual current working directory is maintained separately from the actual process working directory, ensuring tools cannot affect the server's global state.
-
Centralized Path Validation: All path validation is performed by the VFS, ensuring consistent security checks across all tools.
The BashTool is designed with several security measures:
-
Command Whitelisting: Only specific, safe commands are allowed (
pwd,cd,mkdir,ls,echo). -
Command Chaining Prevention: Command chaining operators (
&&,||,;,|, etc.) are disallowed to prevent injection attacks, with a limited exception for the commonmkdir && cdpattern. -
Argument Sanitization: Arguments are parsed using
shlexto properly handle quoted arguments and prevent injection. -
VFS Integration: All directory operations use the VFS to ensure they remain within the allowed directory tree.
Tools like LSTool, ReadTool, and WriteTool implement these security measures:
-
VFS Integration: All file operations are performed through the VFS, which enforces path constraints.
-
Error Handling: Clear error messages are provided without exposing system details.
-
Structured Responses: Tools return structured data rather than raw system responses.
-
Run as Unprivileged User: The proxy should be run as a non-root, unprivileged user with minimal permissions.
-
Network Isolation: By default, the server binds to
127.0.0.1to restrict access to localhost only. -
API Key Security: API keys should be stored in environment variables, not hardcoded.
-
Logging: Enable detailed logging in production to monitor for potential security issues.
-
Resource Limits: Implement resource limits for tool execution (CPU, memory, execution time).
-
Sandboxing: Consider using OS-level sandboxing (e.g., containers, seccomp) for additional isolation.
-
Rate Limiting: Implement rate limiting for tool execution to prevent abuse.
-
Access Control: Add user-based access control for different tools and capabilities.
Regular security testing should include:
-
Path Traversal Tests: Attempt to access files outside the allowed directory.
-
Command Injection Tests: Try to execute unauthorized commands through allowed tools.
-
Fuzzing: Test with unexpected or malformed inputs to ensure robust error handling.
-
Penetration Testing: Conduct regular penetration testing to identify vulnerabilities.