secrets

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 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 Finding

type Finding struct {
	RuleID string
	Match  string
	Secret string
}

Finding stores information about a potential secret found by the scanner.

type GitleaksScanner

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

GitleaksScanner implements the Scanner interface using the gitleaks library.

func NewGitleaksScanner

func NewGitleaksScanner() (*GitleaksScanner, error)

NewGitleaksScanner creates a scanner using gitleaks' embedded default configuration.

func (*GitleaksScanner) Redact

func (s *GitleaksScanner) Redact(content string, findings []Finding) string

Redact replaces *only the Secret part* within each occurrence of a Match string.

func (*GitleaksScanner) Scan

func (s *GitleaksScanner) Scan(content string) ([]Finding, error)

Scan uses the gitleaks detector to find secrets in the content.

type Scanner

type Scanner interface {
	Scan(content string) ([]Finding, error)
	Redact(content string, findings []Finding) string
}

Scanner defines the interface for secret scanning operations.

Jump to

Keyboard shortcuts

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