Trova credenziali e segreti con oltre 170 regole che coprono codice sorgente, URL Web e CI/CD, li verifica rispetto alle API dei fornitori e genera report SARIF, JSONL, HTML, PDF o Excel.
Scanner di secret DAST + SAST con verifica live, parsing delle source-map e reporting nativo per la CI, più un motore SAST per vulnerabilità e misconfigurazioni.
Trova credenziali leaked in alberi di codice sorgente, web app in esecuzione e log della CI. Verificale live contro le API dei vendor. Scansiona gli stessi alberi di codice sorgente per vulnerabilità e misconfigurazioni. Esporta in SARIF per le dashboard di code-scanning, JSONL per pipeline SOAR, oppure Excel/PDF/HTML per i report ai clienti.
Il panorama affollato (gitleaks, trufflehog, detect-secrets) è ottimo per il SAST sugli alberi git ma si ferma lì — e scansiona solo per secret. scan4secrets colma le lacune che gli altri non coprono, aggiungendo DAST web live, verifica live presso i vendor e un motore per vulnerabilità del codice / misconfigurazioni sopra al rilevamento dei secret:
| Capacità | gitleaks | trufflehog | detect-secrets | scan4secrets |
|---|---|---|---|---|
| Rilevamento secret SAST | Y | Y | Y | Y |
| Crawl web DAST live | - | - | - | Y |
| Parsing delle source-map JS | - | - | - | Y |
| Estrazione endpoint JS | - | - | - | Y |
| Scansione secret negli header HTTP | - | - | - | Y |
| Verifica live dei token | - | Y | - | Y |
| Output SARIF | Y | - | - | Y |
| Report Excel / PDF / HTML | - | - | - | Y |
| Entropy gate + allowlist | Y | Y | Y | Y |
| Schema regole YAML | - (TOML) | - | - | Y |
| DAST autenticato (cookie/header/proxy) | n/a | n/a | n/a | Y |
| Rilevamento vulnerabilità / misconfigurazioni SAST | - | - | - | Y |
È un complemento a gitleaks, non un sostituto. Usali entrambi: gitleaks in pre-commit + CI per il SAST sulla cronologia git, scan4secrets per il DAST live contro staging/produzione.
# from source
git clone https://github.com/m14r41/scan4secrets
cd scan4secrets
pip install -e .
# OR via pipx
pipx install git+https://github.com/m14r41/scan4secrets
# OR Docker
docker run --rm -v $(pwd):/scan ghcr.io/m14r41/scan4secrets:latest --path /scan
Dopo l'installazione, il comando scan4secrets è nel tuo PATH.
# SAST: scan a local directory
scan4secrets --path /code
# DAST: crawl a live target
scan4secrets --url https://staging.example.com --threads 32
# DAST runs ALL bundled wordlists by default (1279 paths: /.env, /wp-config.php, /backup.zip, ...)
scan4secrets --url https://target.com
# Use YOUR OWN wordlist file (replaces the bundled set)
scan4secrets --url https://target.com --wordlist /path/to/my-paths.txt
# Combine multiple custom wordlist files
scan4secrets --url https://target.com --wordlist seclists/Common.txt internal-paths.txt
# Restrict to specific bundled wordlists by stem
scan4secrets --url https://wp.example.com --wordlist-only wordpress common env
# Turn wordlist seeding off entirely (only follow live links)
scan4secrets --url https://target.com --no-wordlist
# Full audit with verification + HTML report
scan4secrets --path . --url https://app.example.com \
--verify --report html sarif json \
--output reports/audit-$(date +%F)
# Authenticated DAST with proxy (works with Burp / ZAP)
scan4secrets --url https://app.example.com \
--cookie "session=abc123" \
--header "X-Tenant: acme" \
--proxy http://127.0.0.1:8080
# CI gate (exit 1 if anything >= high)
scan4secrets --path . --report sarif --fail-on high \
--output reports/scan
# SAST: secrets + code vulnerabilities / misconfigurations
scan4secrets --path ./src --misconfig
# SAST: vulnerabilities / misconfigurations only (skip secret detection)
scan4secrets --path ./src --misconfig-only
--misconfig)Oltre ai secret, scan4secrets include un motore SAST per vulnerabilità del codice e misconfigurazioni. Aggiungi --misconfig per scansionare sia secret che vulnerabilità, oppure --misconfig-only per scansionare solo le vulnerabilità:
scan4secrets --path ./src --misconfig # secrets + vulnerabilities
scan4secrets --path ./src --misconfig-only # vulnerabilities only
scan4secrets --path . --misconfig --report html --output report
Rileva — con taint/context gating per mantenere bassi i falsi positivi — SQL injection, NoSQL injection, OS command injection, code injection (eval), SSTI, XXE, deserializzazione insicura, LFI / path traversal, LDAP & XPath injection, SSRF, open redirect, CORS misconfig, CSRF-disabled, prototype pollution, XSS (reflected/stored/DOM su 11 motori di templating: EJS, Handlebars, Pug, Jinja, Thymeleaf, Razor, Blade, ERB, Vue, Angular, React), crypto debole (DES/RC4/ECB/static-IV/weak-RSA), randomness insicura, difetti JWT (alg:none, algorithm confusion, signing secret hardcoded, verifica disabilitata), bypass TLS, confronti di secret non timing-safe, SAML signature-not-required, credenziali hardcoded, logging di dati sensibili e misconfig IaC/config (Terraform, Kubernetes, Dockerfile, GitHub Actions, ASP.NET web.config, WCF/SOAP).
Linguaggi coperti: python, node, javascript, typescript, react, php, ruby, go, java, kotlin, csharp/.NET, sql, più XML/WSDL, JSP, Terraform/HCL, Kubernetes YAML e Dockerfile.
Ogni finding di vulnerabilità porta con sé un record ricco: Nome Vulnerabilità, Severità, Descrizione, Evidenza (file:line), Codice Vulnerabile, Codice Sicuro, Remediation, Impatto Tecnico, Impatto di Business e mappatura CWE + OWASP Top-10.
Oltre al motore riga per riga, una passata sull'intero file cattura i secret che gli scanner per riga non vedono: tag XML annidati (<SMS_API_KEY><value>…</value></SMS_API_KEY>), coppie <key>/<value> separate, oggetti JSON key/value, YAML/properties multi-riga e secret codificati in Base64. Chiude anche un punto cieco dell'entropy gate — le assegnazioni con nomi di credenziali (es. AM_CLIENT_SECRET=…) vengono segnalate sul segnale del nome senza soglia di entropia, così i veri secret a bassa entropia non vengono più scartati silenziosamente.
416 regole in totale — 193 regole per i secret + 223 regole per vulnerabilità / misconfigurazioni.
Le regole per i secret coprono: