Contributing¶
Thanks for helping. Bug reports, new rules and docs fixes are all welcome.
Setup¶
git clone https://github.com/Vasishta03/leakscan
cd leakscan
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
pytest -q && ruff check . && mypy
Add a rule in 10 minutes¶
- Add the rule in
scanner/patterns.py. Give it the next free ID in its group, and never reuse or renumber IDs:
_p("LS-ACME-001", "Acme API Key", r"\bacme_[A-Za-z0-9]{32}\b", "HIGH", "Acme API key"),
Prefer a distinctive prefix. If the secret has none, use _ctx("LS-ACME-002", "Acme Secret", "acme", r"[a-f0-9]{40}", ...),
which anchors on a keyword such as ACME_SECRET=....
- Add fixtures in
tests/corpus.py: one line that must match and one near miss that must not. Use theR()/H()helpers so no literal token ends up in the repo:
"LS-ACME-001": (f"acme_{R(32)}", f"acme_{R(10)}", None),
-
Add remediation in
scanner/remediation.py: what an attacker can do with it, a short blast-radius label, and the page where you rotate it. -
Optional: a verifier. If the provider has a cheap, read-only "who am I" endpoint, add it to
BEARER_CHECKSinscanner/verifier.py. Never use an endpoint that costs money or changes state. -
Run
pytest tests/test_rules.py. CI fails if any rule is missing fixtures.
Pull requests¶
- Keep PRs focused. Add a line to
CHANGELOG.mdunder[Unreleased]. - New behaviour needs a test. Bug fixes should include a test that fails without the fix.
- Don't commit real secrets, even revoked ones. Generate them in tests.
Releasing (maintainers)¶
- Bump
__version__inscanner/__init__.pyand move the[Unreleased]notes into a new version section. git tag vX.Y.Z && git push --tags. The release workflow publishes to PyPI, GHCR and GitHub Releases.- Move the
v1tag for the GitHub Action:git tag -f v1 && git push -f origin v1.
Code of conduct¶
This project follows the Contributor Covenant.