secrets

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner wraps the gitleaks detector.

func NewScanner

func NewScanner() (*Scanner, error)

NewScanner creates a scanner with the best available rule set. Tries betterleaks 269-rule config first, falls back to gitleaks 150-rule default.

func NewScannerConfig

func NewScannerConfig(configTOML string) (*Scanner, error)

NewScannerConfig creates a scanner from a custom TOML config string.

func (*Scanner) HasFindings

func (s *Scanner) HasFindings(content []byte) bool

HasFindings returns true if there are any secrets detected.

func (*Scanner) ScanBytes

func (s *Scanner) ScanBytes(content []byte, filePath string) []SecretFinding

ScanBytes scans raw content and returns findings.

func (*Scanner) ScanString

func (s *Scanner) ScanString(content string, filePath string) []SecretFinding

ScanString scans a string and returns findings.

type SecretFinding

type SecretFinding struct {
	RuleID      string  `json:"rule_id"`
	Description string  `json:"description"`
	Line        int     `json:"line"`
	Column      int     `json:"column"`
	Secret      string  `json:"secret"`
	Entropy     float64 `json:"entropy"`
	Severity    string  `json:"severity"`
	Message     string  `json:"message"`
	FilePath    string  `json:"file_path,omitempty"` // populated in directory mode for SARIF
}

SecretFinding represents a detected secret with AI guidance.

Jump to

Keyboard shortcuts

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