Skip to content

Security: AdrianScott/adapter-claude-code-groq

Security

SECURITY.md

Security Best Practices for Tool Execution

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.

Virtual File System (VFS)

The core of our security model is a Virtual File System (VFS) that provides isolation and sandboxing for all file operations.

Key Security Features

  1. Path Isolation: All file operations are constrained to a specific base directory, preventing access to sensitive system files.

  2. Path Sanitization: All paths are sanitized to prevent directory traversal attacks using .. or other escape sequences.

  3. 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.

  4. Centralized Path Validation: All path validation is performed by the VFS, ensuring consistent security checks across all tools.

Tool Security

BashTool Security

The BashTool is designed with several security measures:

  1. Command Whitelisting: Only specific, safe commands are allowed (pwd, cd, mkdir, ls, echo).

  2. Command Chaining Prevention: Command chaining operators (&&, ||, ;, |, etc.) are disallowed to prevent injection attacks, with a limited exception for the common mkdir && cd pattern.

  3. Argument Sanitization: Arguments are parsed using shlex to properly handle quoted arguments and prevent injection.

  4. VFS Integration: All directory operations use the VFS to ensure they remain within the allowed directory tree.

File Operation Tools

Tools like LSTool, ReadTool, and WriteTool implement these security measures:

  1. VFS Integration: All file operations are performed through the VFS, which enforces path constraints.

  2. Error Handling: Clear error messages are provided without exposing system details.

  3. Structured Responses: Tools return structured data rather than raw system responses.

Deployment Recommendations

  1. Run as Unprivileged User: The proxy should be run as a non-root, unprivileged user with minimal permissions.

  2. Network Isolation: By default, the server binds to 127.0.0.1 to restrict access to localhost only.

  3. API Key Security: API keys should be stored in environment variables, not hardcoded.

  4. Logging: Enable detailed logging in production to monitor for potential security issues.

Future Enhancements

  1. Resource Limits: Implement resource limits for tool execution (CPU, memory, execution time).

  2. Sandboxing: Consider using OS-level sandboxing (e.g., containers, seccomp) for additional isolation.

  3. Rate Limiting: Implement rate limiting for tool execution to prevent abuse.

  4. Access Control: Add user-based access control for different tools and capabilities.

Security Testing

Regular security testing should include:

  1. Path Traversal Tests: Attempt to access files outside the allowed directory.

  2. Command Injection Tests: Try to execute unauthorized commands through allowed tools.

  3. Fuzzing: Test with unexpected or malformed inputs to ensure robust error handling.

  4. Penetration Testing: Conduct regular penetration testing to identify vulnerabilities.

There aren’t any published security advisories