Skip to main content

SecretScanner

CI PyPI Python License: MIT Security policy

Detecta credenciales antes de que lleguen al repositorio. SecretScanner es un escáner local y de código abierto para encontrar secretos hardcodeados mediante CLI, pre-commit, MCP y Visual Studio Code.

$ secret-scanner --path .
[HIGH] GitHub Token · src/config.py:12
[!] 1 posible secreto encontrado

Por qué SecretScanner

  • Local primero: el código y los hallazgos permanecen en tu equipo.
  • Un motor, varios flujos: CLI, hook de Git, servidor MCP y extensión para VS Code.
  • Listo para automatización: códigos de salida apropiados y reportes JSON o CSV.
  • Multiplataforma: compatible con Windows, Linux y macOS mediante Python 3.10 o posterior.

Inicio rápido

Instala el paquete desde PyPI:

pip install secret-scanner-cl
secret-scanner --path .

También puedes mantenerlo aislado con pipx install secret-scanner-cl.

Comandos

# Analizar un archivo o directorio
secret-scanner --path ./mi-proyecto

# Exportar los hallazgos
secret-scanner --path . --output json
secret-scanner --path . --output csv

# Mostrar cada archivo procesado
secret-scanner --path . --verbose
Opción Descripción
--path PATH Archivo o directorio que se analizará.
--output json Guarda los hallazgos en output/report.json.
--output csv Guarda los hallazgos en output/report.csv.
--verbose Muestra los archivos a medida que se procesan.

El proceso termina con código 1 si encuentra posibles secretos y 0 si no encuentra ninguno, por lo que puede utilizarse como control en CI.

Detectores incluidos

Tipo Severidad
Token de GitHub Alta
AWS Access Key Alta
API key genérica Media
Contraseña hardcodeada Alta
JSON Web Token Alta
Token de Slack Alta
Clave privada RSA Alta
URL con credenciales Media

El escáner omite .git, node_modules, entornos virtuales, artefactos de construcción y formatos binarios comunes.

Pre-commit

Añade el hook al archivo .pre-commit-config.yaml. Sustituye v1.0.2 por el release estable que quieras fijar:

repos:
  - repo: https://github.com/Kiara1616/secretscanner
    rev: v1.0.2
    hooks:
      - id: secret-scanner

Después ejecuta pre-commit install. El hook analiza el repositorio antes de permitir el commit.

MCP

El comando secret-scanner-mcp expone el escáner mediante transporte estándar stdio:

{
  "mcpServers": {
    "secret-scanner": {
      "command": "secret-scanner-mcp",
      "args": []
    }
  }
}

Visual Studio Code

La extensión se encuentra en vscode-extension/. Mientras se completa su publicación en Marketplace, puede generarse localmente:

pip install secret-scanner-cl
cd vscode-extension
npm ci
npm run package

Instala el archivo VSIX resultante desde Extensions → ··· → Install from VSIX.... El VSIX es un artefacto de release y no se almacena en Git.

Desarrollo

git clone https://github.com/Kiara1616/secretscanner.git
cd secretscanner
python -m venv .venv
python -m pip install -e ".[dev]"
pytest
ruff check .

La matriz de CI valida Python 3.10–3.13, cobertura mínima de 80 %, estilo, compilación de la extensión y distribuciones para PyPI. Consulta CONTRIBUTING.md antes de enviar cambios.

Seguridad y soporte

No publiques credenciales reales en issues, ejemplos ni reportes. Las vulnerabilidades deben comunicarse en privado siguiendo SECURITY.md. Para preguntas de uso consulta SUPPORT.md.

Estado del proyecto

La hoja de ruta inmediata incluye configuración por proyecto, allowlists, baseline, fingerprints, historial Git y salida SARIF. Consulta CHANGELOG.md para conocer los cambios publicados.

Licencia

SecretScanner se distribuye bajo la licencia MIT.

Release files for secret-scanner-cl 1.0.2

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

Source distribution (sdist)

Source distribution for secret-scanner-cl 1.0.2
File Size Uploaded
secret_scanner_cl-1.0.2.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for secret-scanner-cl 1.0.2
File Interpreter ABI Platform
secret_scanner_cl-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.3 kB

Release files / secret_scanner_cl-1.0.2.tar.gz

Download URL secret_scanner_cl-1.0.2.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7518c85fab6caa5a5427c48c064ff844f4d74decdc1b6ea2a024e38b4bb5ff49
BLAKE2b-256 checksum
How to use checksums
8efa5f2d8c71162e7083fa0decdf423c11094e973c830259fc4fee106c1b0b7e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 26, 2026.

Transparency log

Release files / secret_scanner_cl-1.0.2-py3-none-any.whl

Download URL secret_scanner_cl-1.0.2-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c0895ca20eb7ea1b916768866fd94d04cc8c5fcb8077258a0c80295184edaf06
BLAKE2b-256 checksum
How to use checksums
517d69999a29769ee675726e302b7b6e15bd7e8ec3b5597b4cc9c369a7b39850
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 26, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release 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