secrets

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

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

Detector wraps the gitleaks detector for secret detection.

func NewDetector

func NewDetector() (*Detector, error)

NewDetector creates a Detector with gitleaks default config (~160 patterns).

func (*Detector) Detect

func (d *Detector) Detect(text string) []Finding

Detect scans text and returns all secret findings. Safe to call on nil receiver (returns nil).

func (*Detector) Redact

func (d *Detector) Redact(text string) (string, []Finding)

Redact scans text, replaces each detected secret with [REDACTED:<RuleID>], and returns the redacted string plus the findings. Safe to call on nil receiver (returns original text, nil).

type Finding

type Finding struct {
	RuleID      string // e.g. "aws-access-key"
	Description string // human-readable description from gitleaks
	Match       string // the matched text
}

Finding represents a detected secret.

Jump to

Keyboard shortcuts

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