Contributing to Shield Agents
First off, thank you for considering contributing to Shield Agents! It's people like you that make this tool better for everyone.
How to Contribute
Reporting Bugs
Before creating bug reports, please check the existing issues. When you create a bug report, include as many details as possible:
- OS and Python version
- Shield Agents version (
shield-agents version) - Steps to reproduce
- Expected vs actual behavior
- Scan output or error messages
Suggesting Enhancements
Enhancement suggestions are tracked as GitHub issues. Include:
- Use case - why is this needed?
- Expected behavior - what should it do?
- Current workaround - is there an alternative?
Pull Requests
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run the test suite:
pip install -e ".[dev]" pytest tests/ -v python -m benchmarks.benchmark - Ensure code style:
ruff check shield_agents/ black --check shield_agents/ - Commit with a clear message (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Adding New SAST Rules
- Add the rule to
shield_agents/scanners/sast.pyin theSAST_RULESlist - Add a test case in
tests/test_sast.py - Add a benchmark case in
benchmarks/benchmark.py(optional but recommended) - Update the README with the new rule
Adding New Secret Patterns
- Add the pattern to
shield_agents/scanners/secrets.pyinSECRET_PATTERNS - Add a test case in
tests/test_secrets.py - Consider entropy filtering to reduce false positives
Adding New Agents
- Create a new file in
shield_agents/agents/ - Extend
BaseAgentand implementanalyze()andget_system_prompt() - Add agent-specific patterns to the MockProvider in
llm.py - Register in
shield_agents/agents/__init__.py - Add configuration in
config.py - Wire into the orchestrator in
orchestrator.py - Add tests and update README
Development Setup
# Clone the repository
git clone https://github.com/shield-agents/shield-agents.git
cd shield-agents
# Create a virtual environment
python -m venv venv
source venv/bin/activate # Linux/Mac
# or venv\Scripts\activate on Windows
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest tests/ -v
# Run benchmarks
python -m benchmarks.benchmark --verbose
# Run linter
ruff check shield_agents/
Code Style
- Follow PEP 8
- Use type hints
- Maximum line length: 100 characters
- Use
rufffor linting - Use
blackfor formatting
License
By contributing, you agree that your contributions will be licensed under the MIT License.