Skip to content

Commit 8f1578d

Browse files
committed
2 parents f230fd3 + efdc8a7 commit 8f1578d

File tree

1 file changed

+273
-0
lines changed

1 file changed

+273
-0
lines changed

README.md

Lines changed: 273 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,273 @@
1+
# 🕵️‍♂️🔐 SecretScout
2+
3+
<p align="center">
4+
<img src="https://readme-typing-svg.demolab.com?font=Fira+Code&size=30&duration=3000&pause=1000&color=00FF00&center=true&vCenter=true&width=800&height=80&lines=Stop+secrets+before+they+commit;Scan.+Block.+Commit;Because+oops+is+not+a+security+strategy" alt="SecretScout Slogan">
5+
</p>
6+
7+
<p align="center">
8+
<b>Defensive secret scanning for Git repositories</b><br>
9+
<em>Catch tokens, keys & passwords before they leak into your Git history</em>
10+
</p>
11+
12+
<p align="center">
13+
<img src="https://img.shields.io/badge/Python-3.10%2B-blue?logo=python&style=flat-square" alt="Python 3.10+">
14+
<img src="https://img.shields.io/badge/License-MIT-green?style=flat-square" alt="MIT License">
15+
<img src="https://img.shields.io/badge/Security-Defensive-purple?style=flat-square" alt="Defensive Security">
16+
<img src="https://img.shields.io/badge/CLI-Rich%20Reports-orange?style=flat-square" alt="Rich Reports">
17+
</p>
18+
19+
<p align="center">
20+
<a href="#-quick-start">Quick Start</a> •
21+
<a href="#-features">Features</a> •
22+
<a href="#-usage">Usage</a> •
23+
<a href="#-pre-commit">Pre-commit</a> •
24+
<a href="#-ci--sarif">CI/SARIF</a>
25+
</p>
26+
27+
---
28+
29+
## 🌟 Why SecretScout?
30+
31+
> **One leaked token can compromise an entire environment.**
32+
> SecretScout is your last line of defense *before* secrets get committed.
33+
34+
Unlike reactive scanners that alert you after the damage is done, SecretScout is built for **prevention-first workflows**:
35+
36+
- 🔒 **Pre-commit protection** — scan staged changes before commit
37+
- 🧼 **Clean Git history** — avoid painful “oops, rotate keys” moments
38+
-**Fast** — multi-thread scanning + caching
39+
- 🎨 **Clear reporting** — redacted output, severity levels, actionable context
40+
- 🧩 **CI-friendly** — JSON / SARIF / HTML outputs
41+
42+
---
43+
44+
## 🚀 Quick Start
45+
46+
### Install (from source / dev)
47+
```bash
48+
python -m venv .venv
49+
# Windows PowerShell:
50+
.venv\Scripts\Activate.ps1
51+
# Linux/macOS:
52+
# source .venv/bin/activate
53+
54+
pip install -U pip
55+
pip install -e ".[dev]"
56+
````
57+
58+
### Initialize in your project
59+
60+
```bash
61+
secretscout init .
62+
```
63+
64+
### Scan your repository
65+
66+
```bash
67+
# Scan git-tracked files (default)
68+
secretscout scan .
69+
70+
# Scan everything under the folder
71+
secretscout scan . --all
72+
73+
# Scan only staged changes (perfect for pre-commit)
74+
secretscout scan --staged --format minimal --fail-on high
75+
```
76+
77+
### Test it out (safe demo)
78+
79+
```bash
80+
echo "token=ghp_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" > test_leak.txt
81+
secretscout scan . --all
82+
rm test_leak.txt # Windows: del test_leak.txt
83+
```
84+
85+
---
86+
87+
## ✨ Features
88+
89+
### 🔍 Detection (rules + heuristics)
90+
91+
SecretScout identifies common secret patterns:
92+
93+
* **Provider tokens:** GitHub (`ghp_...`), Google (`AIza...`), Slack, Telegram, etc.
94+
* **Generic assignments:** `password=...`, `api_key: ...`, `token=...`
95+
* **High-entropy strings** (token-like heuristics)
96+
* **Private key headers** (PEM)
97+
98+
### ⚡ Performance
99+
100+
* **Multi-thread scanning**
101+
* **Smart cache** to skip unchanged files
102+
* **Git-aware modes**: tracked / staged / all
103+
104+
### 🎨 Reporting
105+
106+
* Pretty **Rich table** output (default)
107+
* Minimal output for hooks/CI
108+
* Machine formats: **JSON / SARIF / HTML**
109+
* **Redaction**: secrets are never printed in full
110+
111+
### 🛡️ Prevention-first workflow
112+
113+
* Pre-commit ready (`--staged`)
114+
* Baseline mode (ignore legacy findings)
115+
* Flexible ignore patterns + inline suppressions
116+
* Severity thresholds (`--fail-on`)
117+
118+
---
119+
120+
## 🧰 Usage
121+
122+
### Formats
123+
124+
```bash
125+
secretscout scan . --format table
126+
secretscout scan . --format minimal
127+
secretscout scan . --format json --output secretscout.json
128+
secretscout scan . --format sarif --output secretscout.sarif
129+
secretscout scan . --format html --output secretscout_report.html
130+
```
131+
132+
### Baseline (ignore known findings)
133+
134+
```bash
135+
secretscout baseline . --output .secretscout.baseline.json
136+
secretscout scan . --baseline .secretscout.baseline.json
137+
```
138+
139+
### Rules (inspect)
140+
141+
```bash
142+
secretscout rules list
143+
secretscout rules show github-token
144+
```
145+
146+
---
147+
148+
## 🧷 Pre-commit
149+
150+
Pre-commit runs checks automatically on `git commit`.
151+
152+
```bash
153+
pip install pre-commit
154+
pre-commit install
155+
```
156+
157+
Run hooks manually:
158+
159+
```bash
160+
pre-commit run --all-files
161+
```
162+
163+
> The default hook configuration uses `--staged` by design: it scans exactly what will be committed.
164+
165+
---
166+
167+
## 🤖 CI & SARIF
168+
169+
Generate SARIF locally:
170+
171+
```bash
172+
secretscout scan . --format sarif --output secretscout.sarif
173+
```
174+
175+
Upload SARIF in GitHub Actions (snippet):
176+
177+
```yaml
178+
- uses: actions/checkout@v4
179+
- uses: actions/setup-python@v5
180+
with:
181+
python-version: "3.12"
182+
- run: |
183+
pip install -e .
184+
secretscout scan . --format sarif --output secretscout.sarif --fail-on high || true
185+
- uses: github/codeql-action/upload-sarif@v3
186+
with:
187+
sarif_file: secretscout.sarif
188+
```
189+
190+
View results:
191+
**Repo → Security → Code scanning alerts**
192+
193+
---
194+
195+
## ⚙️ Configuration
196+
197+
SecretScout uses TOML + ignore file:
198+
199+
* `.secretscout.toml` — configuration
200+
* `.secretscoutignore` — glob ignore patterns
201+
* `.secretscout-cache/` — cache (do not commit)
202+
203+
Example `.secretscout.toml`:
204+
205+
```toml
206+
[scan]
207+
max_file_size = 1048576
208+
exclude = [".git/**", ".venv/**", "node_modules/**", "dist/**", "build/**", ".secretscout-cache/**"]
209+
threads = 8
210+
first_lines_ignore_file_marker = 5
211+
212+
[report]
213+
fail_on = "high"
214+
max_findings = 200
215+
redact_head = 4
216+
redact_tail = 4
217+
218+
[rules]
219+
disable = []
220+
allowlist = ["(?i)example_token", "(?i)dummy_key", "(?i)changeme"]
221+
path_allowlist = ["(^|/)tests?/fixtures(/|$)"]
222+
```
223+
224+
### Ignoring findings
225+
226+
Ignore a file (must appear within first N lines):
227+
228+
```python
229+
# secretscout:ignore-file
230+
```
231+
232+
Ignore a single line:
233+
234+
```python
235+
token = "ghp_..." # secretscout:ignore
236+
```
237+
238+
---
239+
240+
## ✅ Exit Codes
241+
242+
* `0` — no findings at/above `--fail-on`
243+
* `1` — findings at/above `--fail-on`
244+
* `2` — runtime error
245+
246+
---
247+
248+
## 🛡️ Security Philosophy
249+
250+
* **Offline by default** — no network calls required
251+
* **Redaction** — secrets are never printed fully
252+
* **Defensive tooling** — helps prevent accidental exposure
253+
254+
---
255+
256+
## 🤝 Contributing
257+
258+
```bash
259+
pip install -e ".[dev]"
260+
ruff check .
261+
pytest
262+
```
263+
264+
---
265+
266+
## 📄 License
267+
268+
MIT
269+
270+
<p align="center">
271+
<b>Made for secure development workflows</b><br>
272+
<sub>SecretScout — because prevention beats remediation.</sub>
273+
</p>

0 commit comments

Comments
 (0)