Skip to main content

oneleaks

oneleaks is a lightweight, pure-Python scanner and sanitizer for secrets and PII, designed to run anywhere Python runs: agent workflows, pre-commit hooks, CI, and embedded pipelines. No external binary, no ML models, no network calls required (the one exception: git itself, used only by oneleaks.git).

Full docs: oneleaks.readthedocs.io. The architecture page explains the detection pipeline and sanitization algorithm in detail.

Install

pip install oneleaks
pip install "oneleaks[mcp]"   # + MCP server for agent runtimes

Or from source:

git clone https://github.com/simjay/oneleaks && cd oneleaks
pip install -e ".[mcp]"

Requires Python >= 3.11.

Python API

import oneleaks

result = oneleaks.scan("OPENAI_API_KEY=sk-proj-...\nemail=alice@example.com")
if not result.safe:
    for finding in result.findings:
        print(finding.rule_id, finding.severity, finding.preview)

safe = oneleaks.sanitize("OPENAI_API_KEY=sk-proj-...\nemail=alice@example.com")
print(safe.text)
# OPENAI_API_KEY=<OPENAI_API_KEY_1>
# email=<EMAIL_1>

Reversible sanitization

result = oneleaks.sanitize(text, reveal=True)
restored = oneleaks.desanitize(result.text, result.mapping)  # restored == text

result.mapping is only populated with reveal=True, never by default.

Git, including history

oneleaks.git.scan_changed()   # working-tree changes + untracked files
oneleaks.git.scan_staged()    # staged (index) content
oneleaks.git.scan_history()   # commit history: finds secrets later removed from the tree

Custom rules

oneleaks.scan(text, rules=["company-rules.yaml"])
oneleaks.scan(text, rules=[MyPythonRule()])

CLI

oneleaks scan .
oneleaks scan --changed
oneleaks scan --staged
oneleaks scan --history
oneleaks scan . --json
oneleaks scan . --fail-on high

# adopting oneleaks on a repo that already has findings: baseline them, fail only on new ones
oneleaks scan . --baseline .oneleaks-baseline.json --update-baseline
oneleaks scan . --baseline .oneleaks-baseline.json

some-command | oneleaks sanitize -
oneleaks sanitize file.txt --map mapping.json   # writes a reversible mapping (0600, never default)
oneleaks desanitize sanitized.txt --map mapping.json

Exit codes: 0 clean, 1 findings detected, 2 execution/configuration error.

MCP server

oneleaks-mcp

Exposes scan_text, scan_path, sanitize_text, desanitize_text as MCP tools over stdio, for agent runtimes to call directly. See docs/mcp.md.

Config

.oneleaks.yaml in your project root:

exclude:
  - "node_modules/**"
pii:
  ipv4: false
disabled_rules:
  - datadog-api-key
allow:
  paths:
    - "tests/fixtures/**"

Development

uv sync --all-extras
make format   # ruff format + ruff check --fix
make lint     # ruff check + ruff format --check + mypy
make test     # pytest with coverage
make ci       # lint + test + docs-build (what GitHub Actions runs)

See AGENTS.md for a repo orientation aimed at coding agents, CONTRIBUTING.md for the human contribution guide, and docs/ for full documentation.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oneleaks-0.1.0.tar.gz (210.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oneleaks-0.1.0-py3-none-any.whl (40.2 kB view details)

Uploaded Python 3

File details

Details for the file oneleaks-0.1.0.tar.gz.

File metadata

  • Download URL: oneleaks-0.1.0.tar.gz
  • Upload date:
  • Size: 210.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for oneleaks-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80783ecb1a71019161303c9afdb28710f83572920b2b2a0b5ab1989e69fe7369
MD5 464ec471c057d6c723e29c26f67a8c59
BLAKE2b-256 8f2ff5dca0def4475725f05556db057ae7c815aa88625fa89b5c83ece9a3f10b

See more details on using hashes here.

Provenance

The following attestation bundles were made for oneleaks-0.1.0.tar.gz:

Publisher: publish.yml on simjay/oneleaks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file oneleaks-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: oneleaks-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for oneleaks-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f9ea9b5265ba1cbd035150c0ad87815838db625137c65238b46ea8f121b9dca
MD5 3111f8c84fc211a13faa5c1c754ff73c
BLAKE2b-256 4a0ecdd783f81a61403e3f3cabe89f41131163b5c281758c4108e6e08d43b27b

See more details on using hashes here.

Provenance

The following attestation bundles were made for oneleaks-0.1.0-py3-none-any.whl:

Publisher: publish.yml on simjay/oneleaks

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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