
Offline secrets scanner combining regex rules, lexer-based semantic analysis, and hashed-value matching to detect exposed credentials in code with SARIF output.
Absolutely not!
In our LLM-hype era, DeepSecrets still runs entirely on your machine — giving you great results offline, securely, and for free.
Most existing scanners don't actually "understand" code. Instead, they just parse texts and have bad coverage.
DeepSecrets bridges the gap between classic regex scanners and full-scale commercial SAST tools. It extends the classic regex-based scanning strategy by heavily relying on semantic code analysis, dangerous variable detection, and context-aware entropy analysis. Secret candidates come from what the code says, its names, assignments and calls, not from text alone. DeepSecrets reads code with lexers for about 600 languages and formats (Pygments), and finds variables with detection rules for 14 languages and a generic rule for the rest.
DeepSecrets also introduces a new way to find credentials with zero knowledge: the HashedSecret Engine. Just provide the hashed values of your known production secrets, and the tool will find them exposed in plain text within your code.
DeepSecrets 2.3 was evaluated (November 2026) on the SecretBench benchmark: every file scanned, every labelled row counted.
Counted the way the June 2026 evaluation counted, on its own set of rows, 2.3 has 94% recall and 85% precision (2.0 in June 2026: 93% and 67%).
The figures come from dsbench, an open-source benchmark harness that runs a scanner as a black box over a labelled corpus and counts what it reports. With SecretBench (available from its authors on request) and dsbench, anyone can reproduce the per-row figures above and the comparison below:
dsbench prepare # load SecretBench's labels and the corpus listing
dsbench run --tool-ref v2.3.0 # DeepSecrets 2.3.0 from its tag, in a venv from its own poetry.lock
dsbench tools fetch # the pinned gitleaks and Betterleaks releases, checked by SHA-256
dsbench run --tool gitleaks
dsbench run --tool betterleaks
dsbench compare RUN RUN ... # side by side, with 95% intervals
Every run scans every file, with each tool's path exclusions turned off. The June-way figures also need the June 2026 evaluation's table of rows, and the count of secrets beyond the labels needs our judged verdicts; neither is published, because both point at leaked credentials.
(You can read the full under-the-hood story and benchmark breakdown in my HackerNoon article here)
From Github via pip
$ pip install git+https://github.com/ntoskernel/deepsecrets.git
From PyPi
$ pip install deepsecrets
DeepSecrets needs Python 3.11 or later.
The easiest way to run a scan:
$ deepsecrets --target-dir /path/to/your/code --outformat dojo-sarif --outfile report.json
This will run a scan against /path/to/your/code using the default configuration:
A report in SARIF format (compatible with DefectDojo and GitHub Security) will be saved to report.json.
The --help command is always ready to guide you, but here are the key flags you can use to tailor the scan to your environment:
--regex-rules /path/to/rules.json: Supply your own custom regex ruleset.--hashed-values /path/to/hashes.json: Provide a list of pre-hashed known production secrets to search for them securely.--excluded-paths /path/to/exclusions.json: Override or extend the default paths ignored during scanning.--deep-max-size BYTES: Files larger than this (default 250,000 bytes) get the fast analysis: the regex rules and the variable search, without the language lexer. Big files are mostly generated or minified, the lexer costs most of the scan time on them and rarely finds more there. 0 gives every file the full analysis.--skip-bundles: Skip minified JavaScript, source maps and bundles (*.min.js, *.map, *.bundle.js) entirely, on top of the other path exclusions.--confidence-level {all,low,medium,high,very-high}: The lowest confidence to report (default low, every finding). medium, high and very-high keep confidence 5, 6 and 9 or more, the findings of the SARIF tiers of the same names and above; all also reports the regex matches the scanner judged not to be secrets (placeholders, examples), with an -INFO rule id.--min-confidence N: Report findings of confidence N or more, N from 0 to 10: any cut, where --confidence-level offers the floors of the tiers. Like every level but all, it leaves out the regex matches judged not to be secrets. Use one flag or the other, not both.--exclude-tags TAG [TAG ...]: Leave out the findings that carry any of these tags. A tag says what sort of secret a finding is, where its confidence says how likely it is one: weak-password (a weak value under a password-like name), publishable (a key made to ship to clients: reCAPTCHA and other site keys, Stripe pk_ keys, Mapbox pk. tokens, player, analytics and maps keys), test-context (a test, spec, fixture, mock, example or sample path, relative to the target directory), recorded-traffic (VCR cassettes, session recordings, HAR files), identifier (an AWS id of a user, role or policy, which grants nothing) and web-page (an HTML page). Every finding is still reported by default; e.g. --exclude-tags test-context when you hunt live secrets.--report-diagnostics: Add every file found under the target to the SARIF report, with its status, scan time, skip reason and analysis depth.--regex-candidate-scoring-rules /path/to/rules.json: Supply your own rules for judging regex matches before they are reported. Give the flag no value to report regex matches unjudged.--multiprocessing-context {forkserver,spawn,fork}: How worker processes start. The default is forkserver where the platform has it (Linux, macOS): workers share the scanner already loaded in a server process. Windows uses spawn. All three give the same findings.--disable-masking: Keep potential secrets unmasked in the output report (see caution below).--ci / --no-ci: Turn CI mode on or off. CI mode prints a plain progress line every 30 seconds instead of the live progress display. It turns on by itself inside CI services (GitHub Actions, GitLab CI, Jenkins and others) and whenever the output is not a terminal.eq. .github/workflows/deepsecrets.yml
name: DeepSecrets Scan
on: [push, pull_request]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.14'
- name: Install DeepSecrets
run: pip install deepsecrets
- name: Run Scan
run: deepsecrets --target-dir . --outformat dojo-sarif --outfile report.sarif
continue-on-error: true
- name: Upload SARIF report
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: report.sarif