This document outlines security considerations when using ChatDev.
- Fixed: Replaced
shell=Truewith secure subprocess calls using argument lists - Location:
chatdev/chat_env.pyinfix_module_not_found_error()andexist_bugs() - Impact: Prevents arbitrary command execution through malicious input
- Added: Module name validation using regex patterns
- Added: Project name validation for file system safety
- Added: Company name validation for configuration loading
- Location:
run.py,chatdev/chat_env.py
- Improved: Proper exception handling with specific exception types
- Added: Graceful handling of file operations and JSON parsing
- Location:
run.py,chatdev/chat_chain.py,chatdev/phase.py
-
API Key Security
- Never commit API keys to version control
- Use environment variables for sensitive configuration
- Regularly rotate your OpenAI API keys
-
Input Validation
- Avoid using special characters in project names
- Be cautious with user-provided prompts that might contain sensitive information
-
File System Security
- Run ChatDev in a sandboxed environment when possible
- Review generated code before execution
- Be aware that ChatDev may install Python packages automatically
-
Code Security
- Always validate user inputs
- Use parameterized commands instead of shell=True
- Implement proper error handling
- Follow the principle of least privilege
-
Dependencies
- Regularly update dependencies to patch security vulnerabilities
- Review third-party packages before installation
- Use virtual environments to isolate dependencies
If you discover a security vulnerability, please report it by:
- Do not create a public GitHub issue
- Email the maintainers directly with details
- Include steps to reproduce the issue
- Allow reasonable time for the issue to be addressed before public disclosure
- Input validation for all user-provided data
- No use of
shell=Truewith user input - Proper error handling with specific exceptions
- No hardcoded secrets or credentials
- Documentation of security considerations
- Code review for security implications