Skip to main content

Crate secretscout

Crate secretscout 

Source
Expand description

§SecretScout

A blazingly fast, memory-safe CLI tool for detecting secrets, passwords, API keys, and tokens in git repositories. Built with Rust for maximum performance and safety.

§Features

  • 10x Faster - Rust-powered performance with intelligent caching
  • Memory Safe - Zero buffer overflows, crashes, or memory leaks
  • Dual Mode - Use as standalone CLI or GitHub Action
  • Pre-commit Hooks - Protect staged changes before commit
  • Multiple Formats - SARIF, JSON, CSV, text output
  • Zero Config - Works out of the box with sensible defaults

§Installation

§Via cargo

cargo install secretscout

§Via npm

npm install -g secretscout

§CLI Usage

# Scan a repository
secretscout detect

# Scan with custom config
secretscout detect --config .gitleaks.toml

# Protect staged changes (pre-commit hook)
secretscout protect --staged

§Library Usage

This crate can also be used as a library for integrating secret scanning into your own Rust applications:

use secretscout::{Config, commands};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Scan a repository for secrets
    commands::detect(
        ".",                    // source path
        "results.sarif",        // report path
        "sarif",                // format
        false,                  // redact
        2,                      // exit code on findings
        None,                   // log options
        None,                   // config path
        false,                  // verbose
    ).await?;
    Ok(())
}

§Architecture

This library exposes modules for both native and WASM targets:

  • Native mode (feature = "native"): Full CLI and GitHub Actions functionality
  • WASM mode (feature = "wasm"): Browser-based secret scanning

§Safety

All code in this crate is memory-safe Rust with no unsafe blocks in the main logic. We leverage Rust’s ownership system and type safety to prevent common security vulnerabilities.

Re-exports§

pub use config::Config;
pub use error::Error;
pub use error::Result;
pub use events::EventContext;
pub use events::EventType;
pub use sarif::types::DetectedSecret;

Modules§

binary
Binary management module for downloading and executing gitleaks
cli
CLI argument parsing and command execution
commands
Command implementations for CLI
config
Configuration module for SecretScout
error
Error types for SecretScout
events
Event routing and processing module
github
GitHub API client module
github_actions
GitHub Actions integration
outputs
Output generation module
sarif
SARIF processing module

Constants§

VERSION
Library version

Functions§

is_native
Check if running in native mode
is_wasm
Check if running in WASM mode