Skip to main content

leakscan

Find leaked API keys and secrets in your code, git history, notebooks, archives, Docker images and packages.

PyPI Downloads CI Coverage Python License: MIT

leakscan demo

Quick start

pipx install leakscan        # or: pip install leakscan / brew install vasishta03/leakscan/leakscan
leakscan scan .              # scan the current project
leakscan install-hook        # block commits that contain secrets

Every finding tells you what the key can do if someone else has it, and where to rotate it.

What it scans

Target Command
A folder or file leakscan scan ./src
Staged changes (pre-commit) leakscan scan . --staged
Only what a PR adds leakscan scan . --pr or --base main or --since-commit abc123
Git history leakscan scan . --history --since 2024-01-01
Jupyter notebooks (per cell and output) leakscan scan notebooks/
Zip, tar, wheel and jar files leakscan scan . --archives
stdin or a string cat .env | leakscan scan - or leakscan scan --text "..."
Any git remote (GitHub, GitLab, Bitbucket) leakscan scan https://gitlab.com/group/project
A whole GitHub org leakscan scan --github-org my-org --resume org.json
A Docker image, layer by layer leakscan scan docker://myapp:latest
A published package leakscan scan pypi:requests==2.32.3 or npm:left-pad@1.3.0
A log as it grows leakscan scan app.log --follow

There are 208 rules, each with a stable ID like LS-AWS-001. They cover cloud providers, AI and ML APIs (OpenAI, Anthropic, Mistral, Groq, xAI, Hugging Face and more), payment providers, CI tokens, databases, and secrets hardcoded in Dockerfiles, Terraform, Kubernetes manifests and GitHub Actions workflows. Run leakscan rules list to see them all.

Fewer false positives

  • Placeholders like EXAMPLE, changeme, xxxx, ${VAR} and <your-key> are ignored.
  • GitHub tokens are checked against their built-in CRC32 checksum, card numbers against Luhn, and JWTs must decode.
  • Each finding has a confidence score. It goes up near words like secret or token, and down in tests, fixtures and docs.
  • To ignore one line, add # leakscan:ignore LS-AWS-001 (or just # leakscan:ignore). # nosec and # gitleaks:allow also work.

Check if a key is still live

leakscan scan . --verify
leakscan scan . --verify --verify-only github,openai --verify-timeout 3

This sends each key to its own provider (one read-only "who am I" style request) and marks it active, inactive, unknown or error. It supports 51 secret types. For anything you don't own (a remote repo, an org, an image or a package), you have to pass --yes. The verification docs list exactly which URL each check calls.

CI

GitHub Actions:

- uses: actions/checkout@v4
  with:
    fetch-depth: 0
- uses: Vasishta03/leakscan@v1
  with:
    mode: pr          # full, pr or history
    fail-on: HIGH
    pr-comment: true

This uploads SARIF to code scanning and writes a job summary. Recipes for GitLab CI, Jenkins and CircleCI are in the docs.

pre-commit:

repos:
  - repo: https://github.com/Vasishta03/leakscan
    rev: v0.5.0
    hooks:
      - id: leakscan

Output formats: terminal, json (versioned schema), sarif, html, junit, markdown, csv, sonarqube, defectdojo. Exit codes: 0 clean, 1 findings at or above --fail-on (default HIGH), 2 error.

Python API

import leakscan

result = leakscan.scan_path("src/")
for f in result.findings:
    print(f.rule_id, f.file, f.line_number, f.confidence)

leakscan.scan_text(open(".env").read(), filename=".env")

AI coding agents

leakscan hook stops Claude Code or Cursor from writing a secret into a file or a shell command. leakscan mcp runs an MCP server so an agent can scan text or files before it commits. Setup is in the agent docs.

How it compares

All three are good tools. Pick the one that fits.

leakscan gitleaks trufflehog
Install pip, pipx, brew, Docker, binaries Go binary, brew, Docker Go binary, brew, Docker
Built-in detectors 208 about 200 800+
Live key verification 51 types, opt-in No Yes, most detectors
Staged / diff scanning Yes Yes (--staged) Yes (--since-commit)
Archives and decoding Yes (opt-in) Yes Yes
Docker images, GitHub orgs Yes No Yes, plus S3, GCS, Postman and more
PyPI / npm packages Yes No No
Notebook cell and output locations Yes No No
Blast radius and rotation link per finding Yes No No
Python API Yes Go library No
SARIF Yes Yes Yes

Use gitleaks if raw speed matters most. In our benchmark it scanned the requests repo's full history 4.4x faster than leakscan. Use trufflehog if you need verification across hundreds of services or sources like S3 and Postman. leakscan is the easiest of the three to drop into a Python project or a notebook workflow.

More

  • Docs: configuration (.leakscan.yaml, allowlists, per-directory overrides, rule packs), every CLI flag, the rule catalog, and notifications (Slack, Discord, Teams, email, webhooks)
  • Changelog
  • Contributing. Adding a new rule takes about 10 minutes.
  • Security policy

leakscan sends no telemetry. It only makes network calls when you ask for them (--verify, remote targets, --notify).

If leakscan caught something for you, a star helps other people find it.

MIT licensed.

Metadata

Release files for leakscan 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leakscan 0.5.0
File Size Uploaded Provenance Actions
leakscan-0.5.0.tar.gz 102.4 kB With provenance Details for leakscan-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for leakscan 0.5.0
File Interpreter ABI Platform Actions
leakscan-0.5.0-py3-none-any.whl Python 3 none any Details for leakscan-0.5.0-py3-none-any.whl

Total release size: 198.2 kB

Release files / leakscan-0.5.0.tar.gz

Download URL leakscan-0.5.0.tar.gz
Size 102.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3d38d8ead5c7b67b1c3b917b7360be858075fda796bc9535e8bf6d0952f884f1
BLAKE2b-256 checksum
How to use checksums
a8cf443727ae6990b342da48a4c37f8d133c39a7adbb13e82fb19140543f963d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Release files / leakscan-0.5.0-py3-none-any.whl

Download URL leakscan-0.5.0-py3-none-any.whl
Size 95.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86fea9f4f6e3a36f0875e4600f0594fd9e0e1aaa04a8532c7552619ed663a598
BLAKE2b-256 checksum
How to use checksums
020a54cccb60f6fdb7eff063c0c27e79e10ebff764bb3f120361fe7ced7f7e37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

Security for leakscan 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for leakscan-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page