|
1 | | -# Contributing |
| 1 | +# 🕵️♂️🔐 SecretScout — Contributing Guide |
2 | 2 |
|
| 3 | +<p align="center"> |
| 4 | + <img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=26&duration=3000&pause=900&color=00FF00¢er=true&vCenter=true&width=900&height=70&lines=Contribute+to+SecretScout;Small+PRs.+Strong+Security.;Defensive+only.+No+real+secrets." alt="SecretScout Contributing"> |
| 5 | +</p> |
| 6 | + |
| 7 | +<p align="center"> |
| 8 | + <b>Help us build a prevention-first secret scanner</b><br> |
| 9 | + <em>Fast • Defensive • Offline-friendly • CI-ready</em> |
| 10 | +</p> |
| 11 | + |
| 12 | +<p align="center"> |
| 13 | + <img src="https://img.shields.io/badge/Focus-Defensive%20Security-purple?style=flat-square" alt="Defensive Security"> |
| 14 | + <img src="https://img.shields.io/badge/PRs-Welcome-brightgreen?style=flat-square" alt="PRs Welcome"> |
| 15 | + <img src="https://img.shields.io/badge/Tests-pytest-blue?style=flat-square" alt="pytest"> |
| 16 | + <img src="https://img.shields.io/badge/Lint-ruff-orange?style=flat-square" alt="ruff"> |
| 17 | +</p> |
| 18 | + |
| 19 | +<p align="center"> |
| 20 | + <a href="#-quick-start">Quick Start</a> • |
| 21 | + <a href="#-workflow">Workflow</a> • |
| 22 | + <a href="#-rules--tests">Rules & Tests</a> • |
| 23 | + <a href="#-style--quality">Style & Quality</a> • |
| 24 | + <a href="#-pull-requests">Pull Requests</a> |
| 25 | +</p> |
| 26 | + |
| 27 | +--- |
| 28 | + |
| 29 | +## 🌟 Before You Start |
| 30 | + |
| 31 | +> **SecretScout is defensive.** |
| 32 | +> Contributions must support secure development workflows and **must not** enable offensive behavior. |
| 33 | +
|
| 34 | +### ✅ Contribution Principles |
| 35 | +- **No real secrets** in code, tests, docs, screenshots, or logs. |
| 36 | +- **Offline-first**: avoid network calls/telemetry. |
| 37 | +- **Redaction always**: never print full secret material. |
| 38 | +- Prefer **small, focused PRs**. |
| 39 | + |
| 40 | +### ❌ Do Not Submit |
| 41 | +- “Real” tokens, keys, passwords, private key data |
| 42 | +- Code that exfiltrates, uploads, or reports repository contents |
| 43 | +- Anything that increases risk for users |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## 🚀 Quick Start |
| 48 | + |
| 49 | +### Requirements |
| 50 | +- Python **3.10+** |
| 51 | +- Git |
| 52 | +- (Optional) `pre-commit` |
| 53 | + |
| 54 | +### Install (from source / dev) |
3 | 55 | ```bash |
| 56 | +python -m venv .venv |
| 57 | +# Windows PowerShell: |
| 58 | +.venv\Scripts\Activate.ps1 |
| 59 | +# Linux/macOS: |
| 60 | +# source .venv/bin/activate |
| 61 | + |
| 62 | +pip install -U pip |
4 | 63 | pip install -e ".[dev]" |
| 64 | +```` |
| 65 | + |
| 66 | +### Run tests |
| 67 | + |
| 68 | +```bash |
| 69 | +pytest |
| 70 | +``` |
| 71 | + |
| 72 | +### Run lint |
| 73 | + |
| 74 | +```bash |
| 75 | +ruff check . |
| 76 | +``` |
| 77 | + |
| 78 | +### (Optional) Enable pre-commit |
| 79 | + |
| 80 | +```bash |
| 81 | +pip install pre-commit |
| 82 | +pre-commit install |
| 83 | +pre-commit run --all-files |
| 84 | +``` |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## 🔁 Workflow |
| 89 | + |
| 90 | +### 1) Create a branch |
| 91 | + |
| 92 | +```bash |
| 93 | +git checkout -b feat/my-change |
| 94 | +``` |
| 95 | + |
| 96 | +### 2) Make changes |
| 97 | + |
| 98 | +Keep PRs small and readable. |
| 99 | + |
| 100 | +### 3) Verify locally |
| 101 | + |
| 102 | +```bash |
5 | 103 | ruff check . |
6 | 104 | pytest |
7 | 105 | ``` |
8 | 106 |
|
9 | | -## Добавление нового правила |
10 | | -1) Добавь Rule в `src/secretscout/rules.py` |
11 | | -2) Добавь тест в `tests/` |
12 | | -3) Обнови `docs/RULES.md` |
| 107 | +### 4) Push and open a PR |
| 108 | + |
| 109 | +```bash |
| 110 | +git push -u origin feat/my-change |
| 111 | +``` |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +## 🧩 Rules & Tests |
| 116 | + |
| 117 | +SecretScout detects secrets using **rules (regex + metadata)** and **heuristics**. |
| 118 | + |
| 119 | +### Where things live |
| 120 | + |
| 121 | +* `src/secretscout/cli.py` — CLI commands |
| 122 | +* `src/secretscout/scanner.py` — core scanning |
| 123 | +* `src/secretscout/rules.py` — built-in rules |
| 124 | +* `src/secretscout/reporting.py` — table/json/sarif/html |
| 125 | +* `src/secretscout/config.py` — TOML + defaults |
| 126 | +* `tests/` — unit tests |
| 127 | + |
| 128 | +### Adding or updating a rule |
| 129 | + |
| 130 | +When you add a rule: |
| 131 | + |
| 132 | +* Give it a stable `id` (kebab-case) |
| 133 | +* Add a clear `title` and appropriate `severity` |
| 134 | +* Keep regex specific to reduce false positives |
| 135 | +* Add tests for: |
| 136 | + |
| 137 | + * ✅ positive detection |
| 138 | + * ✅ allowlist behavior (if relevant) |
| 139 | + * ✅ ignore markers behavior (line/file) |
| 140 | + |
| 141 | +### Dummy secrets (safe examples) |
| 142 | + |
| 143 | +Use placeholders only: |
| 144 | + |
| 145 | +* GitHub: `ghp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` |
| 146 | +* Generic: `token=example_token_123` |
| 147 | +* Private key headers with dummy content (never real key bytes) |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +## 🎨 Style & Quality |
| 152 | + |
| 153 | +### Code style |
| 154 | + |
| 155 | +* Keep functions small and well-named |
| 156 | +* Avoid hidden side effects |
| 157 | +* Prefer deterministic behavior (stable results for baseline use) |
| 158 | + |
| 159 | +### Performance |
| 160 | + |
| 161 | +* Avoid reading huge files unnecessarily |
| 162 | +* Respect `max_file_size` |
| 163 | +* Prefer streaming / efficient operations when possible |
| 164 | + |
| 165 | +### Security |
| 166 | + |
| 167 | +* Never print full secrets |
| 168 | +* Prefer redaction everywhere |
| 169 | +* Avoid storing findings beyond what’s needed for the report |
| 170 | + |
| 171 | +--- |
| 172 | + |
| 173 | +## ✅ Pull Requests |
| 174 | + |
| 175 | +### PR checklist |
| 176 | + |
| 177 | +Before opening a PR, ensure: |
| 178 | + |
| 179 | +* [ ] `pytest` passes |
| 180 | +* [ ] `ruff check .` passes |
| 181 | +* [ ] New behavior includes tests |
| 182 | +* [ ] No real secrets anywhere |
| 183 | +* [ ] README/docs updated if you changed CLI behavior or config |
| 184 | + |
| 185 | +### PR description (recommended) |
| 186 | + |
| 187 | +Include: |
| 188 | + |
| 189 | +* What changed (bullet points) |
| 190 | +* Why it changed |
| 191 | +* How to test |
| 192 | +* Any trade-offs / known limitations |
| 193 | + |
| 194 | +--- |
| 195 | + |
| 196 | +## 🐛 Bug Reports |
| 197 | + |
| 198 | +When filing an issue, include: |
| 199 | + |
| 200 | +* OS + Python version |
| 201 | +* Exact command you ran (`secretscout scan ...`) |
| 202 | +* Expected vs actual behavior |
| 203 | +* Minimal repro (no real secrets) |
| 204 | + |
| 205 | +Helpful info: |
| 206 | + |
| 207 | +```bash |
| 208 | +python --version |
| 209 | +secretscout --version |
| 210 | +secretscout scan . --format minimal |
| 211 | +``` |
| 212 | + |
| 213 | +--- |
| 214 | + |
| 215 | +## 📄 License |
| 216 | + |
| 217 | +By contributing, you agree that your contributions will be licensed under the **MIT License**. |
| 218 | + |
| 219 | +<p align="center"> |
| 220 | + <b>Thanks for helping make SecretScout better ❤️</b><br> |
| 221 | + <sub>Small PRs. Strong security. Clean Git history.</sub> |
| 222 | +</p> |
0 commit comments