Skip to main content

open-harness-secretlens

Secret and credential detector for any codebase. Scans source files for hardcoded AWS keys, GitHub tokens, PEM private keys, JWTs, and generic credential assignments. Single native binary, zero runtime dependencies.

Part of the open-harness monorepo. Español abajo.

Same tool, other ecosystems: also available on npm (@open_harness/secretlens) and on Packagist (open-harness/secretlens). Identical binary, identical config; pick the registry that matches your stack.

Install

pip install open-harness-secretlens

pip picks the right native wheel for your platform automatically (Linux x86_64, macOS arm64, macOS x86_64, Windows x86_64). Each wheel embeds the Go binary — no runtime deps.

Usage

secretlens check              # scan current directory
secretlens check --fail       # exit 1 if secrets found (git hooks / CI)
secretlens check --dir ./src  # scan a specific directory
secretlens check --no-color   # plain output for logs
secretlens init               # generate a default secretlens.json
secretlens version            # print version

Built-in patterns

Pattern Severity
AWS Access Key ID (AKIA…) critical
AWS Secret Access Key critical
GitHub Personal Access Token (ghp_…) critical
GitHub Fine-Grained Token (github_pat_…) critical
PEM Private Key (-----BEGIN … PRIVATE KEY) critical
JWT Token high
Generic secret/password/api_key assignment high
Generic token/bearer assignment medium

Configuration

Place a secretlens.json at the repo root:

{
  "patterns": [],
  "allowlist": ["example", "placeholder", "your_key_here", "changeme"],
  "exclude": ["node_modules", "vendor", ".git", "dist"]
}
  • patterns: [] uses the 8 built-in patterns. Override the array to add custom regexes.
  • allowlist skips any line containing the listed strings (case-insensitive) — useful to suppress false positives in docs or examples.
  • exclude skips matching directories entirely.

Alternative: configure inside pyproject.toml or the dedicated secretlens.json

If you prefer not to keep a separate secretlens.json, add a secretlens key in your package.json with the same shape:

{
  "name": "my-project",
  "secretlens": {
    "allowlist": ["example", "your_key_here"],
    "exclude": ["node_modules", "dist"]
  }
}

Precedence: --config <path> > secretlens.json > package.json key > built-in defaults. CLI flags (--no-color, etc.) always win.

Integrations

# Husky pre-commit
secretlens check --fail
# GitHub Actions
- name: Scan for hardcoded secrets
  run: npx @open_harness/secretlens check --fail

Exit codes

Code Meaning
0 No secrets detected (or --fail not passed)
1 Secrets found and --fail was passed, or config error

Español

Detector de secretos y credenciales para cualquier base de código. Escanea archivos buscando claves AWS, tokens de GitHub, claves privadas PEM, JWTs y asignaciones genéricas de credenciales hardcodeadas. Un solo binario nativo, cero dependencias.

Parte del monorepo open-harness.

Instalación

pip install open-harness-secretlens

pip descarga automáticamente la wheel nativa correcta para tu plataforma.

Uso

secretlens check              # escanea el directorio actual
secretlens check --fail       # exit 1 si encuentra secretos (git hooks / CI)
secretlens check --dir ./src  # escanea un directorio específico
secretlens check --no-color   # salida sin colores
secretlens init               # genera un secretlens.json por defecto
secretlens version            # imprime la versión

Patrones integrados

Los 8 patrones built-in cubren claves AWS, tokens GitHub (clásicos y fine-grained), claves privadas PEM, JWTs y asignaciones genéricas tipo secret=…, password=…, api_key=…, token=…, bearer …. Ver la tabla arriba para severidades exactas.

Configuración

Colocá un secretlens.json en la raíz del repo (ver ejemplo arriba).

  • patterns: [] usa los 8 patrones built-in. Sobrescribí el array para agregar regexes propias.
  • allowlist salta cualquier línea que contenga los strings indicados (case-insensitive) — útil para suprimir falsos positivos en docs o ejemplos.
  • exclude ignora completamente los directorios que matcheen.

Alternativa: configurar dentro de pyproject.toml o secretlens.json

Si preferís no tener un secretlens.json separado, agregá una key secretlens en tu package.json con la misma forma del archivo dedicado. Precedencia: --config <path> > secretlens.json > key en package.json > defaults. Los flags CLI siempre ganan.

Integraciones

Sirve con Husky, lefthook o GitHub Actions con los mismos snippets de la sección en inglés.

Códigos de salida

Código Significado
0 No se detectaron secretos (o no se pasó --fail)
1 Hubo secretos con --fail, o error de configuración

License

MIT — see the main repository.

Metadata

Release files for open-harness-secretlens 0.3.4

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

Built distributions (wheels)

Table of built distributions (wheels) for open-harness-secretlens 0.3.4
File Actions
open_harness_secretlens-0.3.4-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for open_harness_secretlens-0.3.4-py3-none-win_amd64.whl
open_harness_secretlens-0.3.4-py3-none-manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details for open_harness_secretlens-0.3.4-py3-none-manylinux2014_x86_64.whl
open_harness_secretlens-0.3.4-py3-none-macosx_11_0_arm64.whl Python 3 none macOS 11.0+ ARM64 Details for open_harness_secretlens-0.3.4-py3-none-macosx_11_0_arm64.whl
open_harness_secretlens-0.3.4-py3-none-macosx_10_9_x86_64.whl Python 3 none macOS 10.9+ x86-64 Details for open_harness_secretlens-0.3.4-py3-none-macosx_10_9_x86_64.whl

Total release size: 6.8 MB

Release files / open_harness_secretlens-0.3.4-py3-none-win_amd64.whl

Download URL open_harness_secretlens-0.3.4-py3-none-win_amd64.whl
Size 2.8 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
641fb72ba842505bd2901142bf0639620e7ff415e9cb89ad857ce24b8f33b1b7
BLAKE2b-256 checksum
How to use checksums
281b54c649a0c8efc04392400d3fd6ae6f8813378ce49ae55cf43dad4d746148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / open_harness_secretlens-0.3.4-py3-none-manylinux2014_x86_64.whl

Download URL open_harness_secretlens-0.3.4-py3-none-manylinux2014_x86_64.whl
Size 1.4 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
f5d1c89b44bc19184a8c6accdd80d2c16fdc460ca4eff524a08fe9c344949a47
BLAKE2b-256 checksum
How to use checksums
b10ac4341bd67ac1d3f313ec87f5c9ae4390a91aae981d39789b255502d94178
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / open_harness_secretlens-0.3.4-py3-none-macosx_11_0_arm64.whl

Download URL open_harness_secretlens-0.3.4-py3-none-macosx_11_0_arm64.whl
Size 1.3 MB
Tags Python 3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
064a98f40274d97957e4f62a752851752503fac0222822c908fa4820aad95383
BLAKE2b-256 checksum
How to use checksums
af9c8cdb28a9502f6fbacd27e1c0ec40c80703b065dc3773b5b72775f2eab180
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / open_harness_secretlens-0.3.4-py3-none-macosx_10_9_x86_64.whl

Download URL open_harness_secretlens-0.3.4-py3-none-macosx_10_9_x86_64.whl
Size 1.4 MB
Tags Python 3 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
3b8939a76fe65862b5e757fec765ec6e3de5dec293d67c9780ab74671594c686
BLAKE2b-256 checksum
How to use checksums
71b250a61e6160d89140958ff592ec253a72dea217af084fddcd6c77c72be4c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Security for open-harness-secretlens 0.3.4

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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