π Secret Scanner for CI/CD & Git Hooks
SentinelSecrets is an open-source tool for preventing secret leaks (API keys, tokens, passwords) in Git repositories and CI/CD.The project integrates directly into the development process via Git hooks, blocking a commit if a secret is detected in it.
A tool that automatically prevents secrets (API keys, tokens, passwords) from leaking before code is pushed to the repository:
-
Checks git diffs before committing
-
Uses regular expressions + entropy analysis
-
Suitable for local development and CI/CD
-
Generates reports in JSON and Markdown
-
Has a REST API with OpenAPI (Swagger)
- Leak Prevention: Stops secrets from leaking into public and corporate repositories.
- Risk Mitigation (Shift Left Security): Security is checked at the coding stage, not after deployment.
- Audit Automation: Report generation in JSON format allows for easy integration into corporate security dashboards.
sentinel-secrets/
βββ sentinel/
β βββ __init__.py
β βββ scanner.py
β βββ entropy.py
β βββ git_utils.py
β βββ ignore.py
β βββ report.py
βββ hooks/
β βββ pre-commit # git pre-commit hook
βββ tests/
β βββ test_scanner.py
βββ examples/
β βββ example_report.md
βββ .sentinelignore
βββ .pre-commit-hooks.yaml
βββ .pre-commit-config.yaml
βββ main.py
βββ pyproject.toml
βββ README.md
βββ SECURITY.md
βββ LICENSE
βββ requirements.txt
π Regex + entropy search
π Entropy
Git pre-commit hook
π REST API (Swagger)
Swagger will be available on:
http://localhost:8000/docs- π Regex search (AWS, GitHub, JWT, passwords)
- π Entropy analysis (Shannon entropy)
- π§ False positive minimization
- πͺ Git pre-commit integration
- π Reports: JSON / Markdown / HTML
- π HTML report with graphs (Chart.js)
- β Commit locking on leak
git clone https://github.com/mscbuild/sentinel-secrets-.git
cd sentinel-secrets-
pip install -r requirements.txtpython main.py --file app.py-
scanner.py β signatures and search logic
-
entropy.py β random secret detection
-
git_utils.py β working with git diff
-
api.py β REST API
-
API key leaks to public repositories
-
Cloud account compromise
-
SOC2/ISO 27001 compliance violations
-
Supply chain attacks
pip install pytest
pytest -vImportant
Use git filter-repo (recommended) or BFG Repo-Cleaner to remove secrets from Git history.
Note
My project is lightweight, customizable to the company's internal formats, and written in pure Python for easy auditing.
This project is developed in compliance with the OWASP Code Review Guide.
MIT License
Copyright (c) 2025 Mscbuild