engine

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package engine provides the Leakwatch scan engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Concurrency   int
	Detectors     []detector.Detector
	EnableEntropy bool
	// EntropyThreshold is the minimum Shannon entropy a HEURISTIC match must have
	// to be reported. When EnableEntropy is set the engine computes
	// Finding.Entropy for every match (informational), but only drops a finding
	// when its detector opts into the gate via EntropyBased() — i.e. the generic
	// API-key detector and other high-entropy-string heuristics. Structural
	// detectors (AWS, GitHub, Stripe, …) are never entropy-gated, so a valid but
	// low-entropy key is always reported. When EnableEntropy is false no entropy
	// is computed and no gating is applied. Defaulted to defaultEntropyThreshold.
	EntropyThreshold float64
	ShowRaw          bool
	Clock            func() time.Time // Optional; defaults to time.Now
	VerifierConfig   verifier.Config
	Verifiers        []verifier.Verifier
	OnlyVerified     bool             // If true, only return verified active findings
	MinSeverity      finding.Severity // Minimum severity to include in results
}

Config holds the scan engine configuration.

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine is the scan engine that orchestrates detection and verification.

func New

func New(cfg Config) *Engine

New creates a new scan engine. The Aho-Corasick automaton is compiled from detector keywords.

func (*Engine) Scan

func (e *Engine) Scan(ctx context.Context, src source.Source) (*ScanResult, error)

Scan scans the given source and returns results.

type ScanResult

type ScanResult struct {
	Findings      []finding.Finding
	ScannedChunks int
	Duration      time.Duration
	Interrupted   bool
}

ScanResult represents the outcome of a scan.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL