secretscanner
Integrates as a pre-commit hook to prevent commits containing secrets.
SecretScanner — Analizador de Secretos
Herramienta de código abierto desarrollada en Python 3.10 que analiza proyectos de software y detecta secretos y credenciales hardcodeadas (API keys, tokens, contraseñas, claves privadas) mediante expresiones regulares.
Características
Soporte para cualquier directorio o archivo de texto.
Detección automática del tipo de secreto encontrado.
Recorrido recursivo de directorios con
os.walk.Análisis basado en 8 patrones regex documentados: GitHub Token, AWS Access Key, API Key genérica, contraseña hardcodeada, JWT Token, Slack Token, clave privada RSA y URL con credenciales.
Salida en consola con colores diferenciados por severidad.
Exportación de reportes a JSON y CSV en la carpeta
output/.Interfaz de línea de comandos (CLI) con
--path,--outputy--verbose.
Related MCP server: mcp-security-toolkit
Requisitos
Python 3.10 o superior
pip
Instalación
Instala la herramienta fácilmente desde PyPI usando pip:
pip install secret-scanner-cl(Opcional) Si usas pipx para gestionar herramientas de consola en entornos aislados:
pipx install secret-scanner-clUso de la CLI
Una vez instaladas las dependencias, ejecuta la herramienta con:
python main.py --path <ruta-del-proyecto>Parámetros y opciones
Opción | Descripción |
| (Requerido) Ruta al directorio o archivo a analizar |
| Exporta el reporte a |
| Exporta el reporte a |
| Muestra cada archivo procesado durante el escaneo |
Ejemplos
# Analizar el directorio actual
python main.py --path .
# Analizar una ruta específica y exportar JSON
python main.py --path ./mi_proyecto --output json
# Analizar y exportar CSV
python main.py --path ./mi_proyecto --output csv
# Modo verbose — muestra cada archivo procesado
python main.py --path ./mi_proyecto --verbose
# Modo Verbose + Exportar JSON
python main.py --path ./mi_proyecto --verbose --output jsonIntegración con Agentes de IA (MCP Skill)
SecretScanner incluye un servidor compatible con el Model Context Protocol (MCP), lo que permite que herramientas de Inteligencia Artificial (como Claude Desktop o Cursor) utilicen este analizador de manera nativa como una "Skill".
Para iniciar el servidor MCP, puedes utilizar el comando global que se instala automáticamente con el paquete:
secret-scanner-mcpNota: Este comando se comunica usando la entrada y salida estándar (stdio), diseñado específicamente para ser consumido por un Agente IA, no por humanos.
Cómo configurarlo en Claude Desktop / Agentes compatibles
Añade la siguiente configuración al archivo de configuración de tu Agente (ej. claude_desktop_config.json):
{
"mcpServers": {
"secret-scanner": {
"command": "secret-scanner-mcp",
"args": []
}
}
}Extensión de Visual Studio Code
Este proyecto incluye una Extensión oficial para VSCode que subraya en rojo los secretos directamente en el código fuente.
Instalación
Dirígete a la carpeta
vscode-extension/en este repositorio.Encuentra el archivo compilado
secret-scanner-vscode-1.0.0.vsix.Instálalo en Visual Studio Code:
Abre VSCode > Panel de Extensiones (Ctrl+Shift+X).
Haz clic en los tres puntos
...arriba a la derecha > Install from VSIX...Selecciona el archivo
.vsix.
Uso
La extensión se activará automáticamente y escuchará cada vez que guardes un archivo (Ctrl+S). Si tu archivo contiene una contraseña o un token que rompe las reglas, aparecerá un subrayado rojo (Warning/Error) directamente en el editor. También puedes invocar manualmente el escaneo con el comando de VSCode: SecretScanner: Scan Current File.
(Nota: Debes tener instalado secret-scanner-cl globalmente vía pip para que la extensión funcione).
Integración con pre-commit (Git Hooks)
Puedes integrar este escáner de secretos directamente en tu flujo de trabajo de Git utilizando el framework oficial pre-commit. Esto evitará que hagas git commit accidentalmente si hay contraseñas en tu código.
Para usarlo, añade lo siguiente a tu archivo .pre-commit-config.yaml en tu repositorio:
repos:
- repo: https://github.com/Kiara1616/secret-scanner
rev: v1.0.0 # Asegúrate de usar la última versión disponible (o la rama main)
hooks:
- id: secret-scannerLuego ejecuta pre-commit install en tu terminal para activar el hook.
Ejemplo de salida
🔍 Analizando: ./mi_proyecto
[ALERTA] GitHub Token encontrado Archivo : mi_proyecto/config.py Línea : 12 Contenido: token = "ghp_1234...****"
[ALERTA] Contraseña hardcodeada encontrada Archivo : mi_proyecto/db.py Línea : 8 Contenido: password = "****"
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ Análisis completado Archivos analizados : 24 Secretos encontrados : 2 Reporte exportado : output/report.json ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
text
Tipos de secretos detectados
Tipo | Patrón detectado |
GitHub Token |
|
AWS Access Key |
|
API Key genérica |
|
Contraseña hardcodeada |
|
JWT Token |
|
Slack Token |
|
Clave privada RSA |
|
URL con credenciales |
|
Archivos ignorados
El escáner omite automáticamente extensiones binarias (.png, .jpg, .gif, .exe, .zip, .pdf) y directorios no relevantes (.git, __pycache__, node_modules, output).
Desarrollo y tests
# Instalar dependencias de desarrollo
pip install -r requirements-dev.txt
# Ejecutar todos los tests
pytest
# Ver cobertura por módulo
pytest --cov=scanner --cov-report=term-missing
# Tests de un módulo específico
pytest tests/test_patterns.py -vLa cobertura mínima requerida es 80% sobre el paquete scanner/.
CI/CD
El proyecto cuenta con un pipeline de GitHub Actions (.github/workflows/ci.yml) que se activa en cada push y pull_request hacia main, instala dependencias, ejecuta los tests con cobertura y falla el build si algún test no pasa.
Available Tools
1 toolscan_secretsA
Escanea un directorio o archivo en busca de contraseñas, tokens y claves API hardcodeadas.
Args: target_path: Ruta absoluta o relativa al archivo o carpeta que se desea analizar.
Returns: Un resumen en texto plano de los secretos encontrados.
| Name | Required | Description | Default |
|---|---|---|---|
| target_path | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description bears full burden for behavioral context. It does not disclose whether the scan is read-only, requires special permissions, or any side effects. The return type is mentioned but not the depth or scope of scanning.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and well-structured with clear Args and Returns sections. Every sentence serves a purpose with no redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool has an output schema (not shown) and one parameter, the description is adequate but lacks details on recursion, file types scanned, or performance implications. It provides a minimal viable explanation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The single parameter 'target_path' is described as an absolute or relative path to a file or folder to analyze, adding meaningful context beyond the schema's bare title. Schema description coverage is 0%, so the description compensates well.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool scans a directory or file for hardcoded passwords, tokens, and API keys. It uses a specific verb and resource, and distinguishes itself from any potential siblings (none listed).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance is given on when to use this tool versus alternatives, nor any prerequisites or contextual cues. The description only states what it does without any usage direction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v1.0.1- First observed
scan_secrets
TDQS
With only one tool, there is no ambiguity. The tool has a distinct purpose of scanning for secrets.
The single tool name 'scan_secrets' follows a clear verb_noun pattern, consistent within itself.
A single tool is appropriate for a focused secret scanning server, though it feels minimal.
The tool covers the core scanning functionality but lacks features like result filtering or detailed reports, leaving some gaps.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Security scanner for MCP servers. Detect vulnerabilities, prompt injection, and tool poisoning.
ArcAgent MCP server for bounty discovery, workspace execution, and verified coding submissions.
MCP server for building and testing AI agents with multi-model experimentation and insights.
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceMCP server for ai-scanner that enables AI agents to scan codebases for LLM usage, AI frameworks, and exposed secrets.701MIT
- AlicenseNot gradedqualityBmaintenanceAn MCP server that wraps Trivy and Gitleaks to provide file system vulnerability and secret scanning as tools for AI agents, enabling local, free security analysis.MIT
- AlicenseAqualityDmaintenanceAn MCP server that lets AI agents autonomously acquire, store, verify, and manage API keys for various services.713MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server that scans code for exposed secrets (API keys, tokens, private keys, high-entropy strings) with placeholder-aware allowlisting and fully redacted reports, enabling agents to detect leaks before committing.1MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kiara1616/secretscanner'
If you have feedback or need assistance with the MCP directory API, please join our Discord server