An extensible secret validation tool with dynamic plugin system for identifying and validating leaked credentials. validate-secrets is designed to help developers and security teams to identify and validate credentials that have been accidentally exposed in code repositories or other data sources. It supports multiple validators, integrates with GitHub Secret Scanning REST API. It provides a CLI interface with support for ease of use and further integration.
-
Post Incident Credential Validation - When a security incident because of exposed credentials, security teams need to quickly determine which credentials are still active.
-
Continuous Monitoring of GitHub Secret Scanning Alerts - Development teams using GitHub's Secret Scanning can automate the validation of open alerts to prioritize remediation efforts, reduce false positives, and focus on actual threats.
- Dynamic Plugin System: Auto discovers validators using
pkgutilscanning - Multiple Data Sources: Local file input based and GitHub Secret Scanning integration via REST API
- Flexible Configuration: Environment based configuration with .env support or command line arguments
- Multiple Input and Output Formats: CSV, JSON, and table output
- Extensible Architecture: Rather easy to add new/your own validators
Start with AGENTS.md for the shared human/agent onboarding route.
Architecture explains the parts and maps code to tests.
Project instructions cover contracts and
lessons learned. Development covers setup,
checks, the review workflow, and local .logs/ artifacts;
Python instructions define coding conventions.
See CONTRIBUTING.md for contribution and validator guidance.
Using uv (recommended):
git clone https://github.com/advanced-security/validate-secrets.git
cd validate-secrets
uv sync --locked
uv run validate-secrets --helpWith uv, prefix the commands below with uv run to use the project environment.
Contributors should use uv sync --dev --locked as described in
development.
Using pip:
git clone https://github.com/advanced-security/validate-secrets.git cd validate-secrets pip install -e .
Best way to get familiar with the CLI is to run the help command:
validate-secrets --help
List available validators:
validate-secrets list-validators
Validate a single secret:
validate-secrets validate "AIzaSyABC123..." google_api_keyCheck GitHub Secret Scanning alerts:
validate-secrets check-github --org myorg --format json
Validate secrets from files:
Text files (secret_type required):
validate-secrets check-file input/secrets_file.txt google_api_key --file-format text --format table
CSV files (secret_type read from file):
validate-secrets check-file input/secrets_file.csv --file-format csv --format table
JSON files (secret_type read from file):
validate-secrets check-file input/secrets_file.json --file-format json --format table
| Validator | Description | Supported Formats |
|---|---|---|
fodselsnummer |
Norwegian National Identity Numbers | Text |
google_api_key |
Google API Keys | AIza... format |
microsoft_teams_webhook |
Microsoft Teams/Office 365 Webhooks | webhook.office.com URLs |
snyk_api_token |
Snyk API Tokens | API tokens |
databricks_token |
Databricks Personal Access Tokens | dapi... format |
flickr_api_key |
Flickr API Keys | API keys |
clickup_api_key |
ClickUp API Keys | API keys |
vercel_access_token |
Vercel Access Tokens | API tokens |
vercel_cli_token |
Vercel CLI Tokens | CLI tokens |
datadog_api_key |
Datadog API Keys | API keys |
launchdarkly_api_key |
LaunchDarkly API Keys | API keys |
launchdarkly_access_token |
LaunchDarkly Access Tokens | API tokens |
pagerduty_api_key |
PagerDuty API Keys | API keys |
browserstack_token_url |
BrowserStack Automate Credentials | username:access_key |
Note: Most accurate way to see available validators is to run validate-secrets list-validators command.
The tool for a lot of use cases can be controlled via the provide CLI options. Another way to configure the tool is using environment variables. The .env file is a common way another way to do this. With validate-secrets the primarily use is to override default values and easier integration in CI/CD systems. The GITHUB_TOKEN is required for GitHub integration.
You can copy the example file provided in the repository:
cp .env.example .env
# GitHub Configuration GITHUB_TOKEN=ghp_xxx # This is mandatory for GitHub integration GITHUB_ORG=my-organization # Optional, can be provided in CLI GITHUB_REPO=my-repository # Optional, can be provided in CLI GITHUB_API_URL=https://api.github.com # Optional, only needed if you are integrating with your GHES or GHEC DR instance # Validation Configuration - All options are optional, can be provided in CLI VALIDATION_TIMEOUT=30 ENABLE_NOTIFICATIONS=false # Output Configuration - All options are optional, can be provided in CLI DEFAULT_OUTPUT_FORMAT=csv DEFAULT_INPUT_FORMAT=text LOG_LEVEL=INFO # Vendor API region/site selection (optional; defaults to US) DATADOG_SITE=datadoghq.com LAUNCHDARKLY_HOST=app.launchdarkly.com PAGERDUTY_HOST=api.pagerduty.com
DATADOG_SITE accepts datadoghq.com, us3.datadoghq.com,
us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com,
ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, or
us2.ddog-gov.com. LAUNCHDARKLY_HOST accepts
app.launchdarkly.com, app.eu.launchdarkly.com, or
app.launchdarkly.us; PAGERDUTY_HOST accepts api.pagerduty.com or
api.eu.pagerduty.com. Unrecognized values skip the request.
Flickr uses a form POST to its read-only flickr.test.echo method to keep the
key out of debug URLs; only documented error code 100 returns invalid.
Other new vendor validators are positive-only: rejections, permission errors,
and ambiguous responses return unknown. LaunchDarkly checks api- keys only;
SDK/mobile keys are not supported. Isolated HTTP sessions ignore environment
proxy, netrc, and custom CA bundle settings.
Support multiple file formats with different requirements for secret type specification:
Text files (one secret per line, secret_type required as command argument):
AIzaSyABC123...
AIzaSyDEF456...
Usage:
validate-secrets check-file secrets.txt google_api_key --file-format text
CSV files (secret_type read from 'type' column):
secret,type AIzaSyABC123...,google_api_key sk_test_123...,stripe_key
Usage:
validate-secrets check-file secrets.csv --file-format csv
JSON files (secret_type read from 'type' property):
[
{"secret": "AIzaSyABC123...", "type": "google_api_key"},
{"secret": "sk_test_123...", "type": "stripe_key"}
]Usage:
validate-secrets check-file secrets.json --file-format json
Integrate with GitHub Secret Scanning alerts via the REST API:
# Organization level validate-secrets check-github --org myorg # Repository level validate-secrets check-github --repo owner/repo # Filter by secret type, state and validity validate-secrets check-github --org myorg --secret-type google_api_key --state open --validity unknown
Supports multiple output formats for results with the --format option:
- CSV: Comma-separated values (default)
- JSON: JSON format with metadata
- Table: Rich table format for terminal output
With the --output option you can also specify the file to write the output to:
validate-secrets check-file secrets.txt google_api_key --file-format text --output results.csv
Validate Databricks Personal Access Tokens against a workspace. The --host-url flag provides the workspace URL:
# Validate a single token validate-secrets validate "dapi1234abcd..." databricks_token --host-url https://my-workspace.cloud.databricks.com
This project is licensed under the terms of the MIT open source license. Please refer to LICENSE.md for the full terms.
- @theztefan - Core Maintainer
- @aegilops - Core Maintainer
- Issues: Report bugs and feature requests on GitHub issues page
- Contributions: Contributions are welcome! Please read the CONTRIBUTING.md for guidelines.
- Security: Check our security policy SECURITY.md