File size: 2,812 Bytes
de31cf7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# 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

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run the test suite:
   ```bash
   pip install -e ".[dev]"
   pytest tests/ -v
   python -m benchmarks.benchmark
   ```
5. Ensure code style:
   ```bash
   ruff check shield_agents/
   black --check shield_agents/
   ```
6. Commit with a clear message (`git commit -m 'Add amazing feature'`)
7. Push to the branch (`git push origin feature/amazing-feature`)
8. Open a Pull Request

### Adding New SAST Rules

1. Add the rule to `shield_agents/scanners/sast.py` in the `SAST_RULES` list
2. Add a test case in `tests/test_sast.py`
3. Add a benchmark case in `benchmarks/benchmark.py` (optional but recommended)
4. Update the README with the new rule

### Adding New Secret Patterns

1. Add the pattern to `shield_agents/scanners/secrets.py` in `SECRET_PATTERNS`
2. Add a test case in `tests/test_secrets.py`
3. Consider entropy filtering to reduce false positives

### Adding New Agents

1. Create a new file in `shield_agents/agents/`
2. Extend `BaseAgent` and implement `analyze()` and `get_system_prompt()`
3. Add agent-specific patterns to the MockProvider in `llm.py`
4. Register in `shield_agents/agents/__init__.py`
5. Add configuration in `config.py`
6. Wire into the orchestrator in `orchestrator.py`
7. Add tests and update README

## Development Setup

```bash
# 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 `ruff` for linting
- Use `black` for formatting

## License

By contributing, you agree that your contributions will be licensed under the MIT License.