This document outlines the contribution process for the Validate Secrets project, including information about the structure and architecture of the project as well as how to add new validators, run tests, etc.
- Registry System (
core/registry.py): Auto-discovers and manages validators - Base Classes (
core/base.py): Abstract base class for validators - Data Sources (
sources/): Abstraction layer for different input sources - CLI Interface (
cli.py): Click-based command-line interface
The system uses pkgutil.iter_modules() to scan the validators/ directory and automatically register any class that inherits from Checker.
All validators support configurable timeouts using signal-based interruption to prevent hanging on network requests.
- Timeout Controls: Prevent hanging on slow network requests
- Memory Efficient: Streaming file processing for large files
- Progress Indicators: Real-time progress feedback
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-validator - Add your validator to
src/validate_secrets/validators/ - Add tests for your validator
- Submit a pull request
git clone https://github.com/advanced-security/validate_secrets.git
cd validate_secrets
uv install --devuv run python -m pytest tests/ -vuv run black src/ tests/- Inherit from
Checkerbase class - Implement
check(secret: str) -> Optional[bool]method - Return
Truefor valid,Falsefor invalid,Nonefor errors - Add proper error handling and logging
- Include timeout support for network requests
- Provide clear name and description attributes
The plugin system automatically discovers new validators. Create a new file in src/validate_secrets/validators/:
# src/validate_secrets/validators/my_validator.py
from ..core.base import Checker
class MySecretChecker(Checker):
"""Custom secret validator."""
name = "my_secret"
description = "Validates my custom secrets"
def check(self, secret: str) -> Optional[bool]:
"""Validate the secret."""
# Your validation logic here
if secret.startswith("mysecret_"):
# Make API call or validate format
return True # Valid
return False # InvalidThe validator will be automatically discovered and available via CLI:
validate-secrets list-validators
validate-secrets validate "mysecret_123" my_secret