scanner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package scanner detects secrets in blob bytes without traversing repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding = report.Finding

Finding includes the matched rule, secret, source location, and validation details.

type Options

type Options struct {
	// Config overrides the default corpus. Do not modify it after New.
	Config *config.Config
	// Validation enables outbound credential checks only when Enabled is true.
	Validation  detect.ValidationOptions
	RuleTimings *detect.RuleTimingCollector
}

Options configures a scanner. The zero value uses the embedded corpus locally.

type Result

type Result struct {
	Findings []Finding
	Scanned  bool
}

Result contains findings and whether text passed the prefilter. Binary blobs have Scanned false but can still produce path-only findings.

type Scanner

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

Scanner shares its compiled rules and prefilter across concurrent Scan calls. Close it after use to release its resources.

func New

func New(ctx context.Context, opts Options) (*Scanner, error)

New constructs a scanner once for any number of blobs. Canceling ctx cancels detection and validation in all Scan calls.

func (*Scanner) Close

func (s *Scanner) Close() error

Close cancels active scans and releases scanner resources. It is idempotent.

func (*Scanner) Engine

func (s *Scanner) Engine() string

Engine identifies the embedded or compiled prefilter in use.

func (*Scanner) Scan

func (s *Scanner) Scan(ctx context.Context, data []byte, path string) (Result, error)

Scan detects secrets in data. An empty path disables path-based checks. Findings contain unredacted secrets. History traversal and OID caching belong to callers.

Jump to

Keyboard shortcuts

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