secrets

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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