Skip to content

feat: add config file, SARIF output, CI/CD integrations, and betterleaks-inspired features #71

Description

@pixincreate

Is your feature request related to a problem?

Keywatch currently has 106 built-in detectors and supports scanning files, directories, git history, and stdin with baseline/inline suppression. However, compared to gitleaks (222 rules, TOML config, SARIF, GitHub Action) and its successor betterleaks (CEL validation, BPE tokenization, async secret validation), keywatch lacks several capabilities that would make it production-ready for CI/CD pipelines and enterprise adoption.

Describe the solution you'd like

I'd like to add the following features inspired by gitleaks and betterleaks:

  1. User-Configurable TOML Config File (like gitleaks' .gitleaks.toml)
    Allow users to define custom rules, overrides, and allowlists in a .keywatch.toml file instead of requiring code changes. Should merge with built-in detectors.toml at runtime.

  2. SARIF Output Format (like gitleaks' --report-format sarif)
    Enable keywatch to emit SARIF (Static Analysis Results Interchange Format) so findings appear in GitHub's Security tab / Code Scanning alerts.

  3. Official GitHub Action
    Publish a keywatch/scan GitHub Action for CI/CD pipeline integration.

  4. Pre-commit Framework Support
    Ship .pre-commit-hooks.yaml so users can add keywatch via the pre-commit framework.

  5. Rule-Level Severity & Tags
    Allow per-rule severity assignment in config (like gitleaks' [rules.tags] and severity field).

  6. Expression-Based Allowlist (inspired by betterleaks' CEL filtering)
    Support contextual allowlist expressions that evaluate fragment attributes (git author, commit message, file path) beyond simple regex matching.

  7. Secrets Validation / Verification
    Optional async HTTP requests to verify if detected credentials are still active (betterleaks' CEL validation model).

  8. Docker Image & Homebrew Formula
    Publish multi-arch Docker images and a Homebrew tap for easier distribution.

  9. Per-Detector Enable/Disable in Config
    Allow users to disable noisy detectors via config without removing them from the binary.

Example Implementation

// Example: Config-driven custom rule (loading from .keywatch.toml)
// This would merge with built-in detectors at startup

// .keywatch.toml
// [rules]
// [rules.my-custom-api]
// pattern = 'my-api-key-[A-Za-z0-9]{32}'
// severity = "HIGH"
// keywords = ["my-api"]
// allowlist.paths = ["tests/**"]

// CLI usage:
// key-watch scan . --config .keywatch.toml
// key-watch scan . --format sarif --output report.sarif

Additional context

All features are directly inspired by gitleaks (MIT, 27k+ stars) and its successor betterleaks (MIT, 1.2k+ stars). Gitleaks pioneered user-configurable TOML rules, SARIF output, and GitHub Action support — these are standard expectations for a modern secrets scanner. Betterleaks advances the category with CEL-based validation and expression filtering. Keywatch should match these capabilities while maintaining its Rust performance advantage.

Priority

Important

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions