secrets

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: AGPL-3.0 Imports: 8 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

View Source
const MaxFindings = 1000

MaxFindings caps the findings one ScanText call returns. A scan of text full of matches would otherwise return, and the caller store, as many findings as the text has matches.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scanner

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

Scanner scans text for secrets.

func NewScanner

func NewScanner(log *logger.Logger) *Scanner

NewScanner creates a new secret scanner.

func (*Scanner) ScanMetadata

func (s *Scanner) ScanMetadata(metadata map[string]any) []models.SecretFinding

ScanMetadata scans artifact metadata map for secrets.

func (*Scanner) ScanText

func (s *Scanner) ScanText(text string) []models.SecretFinding

ScanText scans a text string for secrets. It returns at most MaxFindings findings, those of the first patterns in pattern order and, within a pattern, in text order; every match, reported or not, is masked in the line hints.

type SecretPattern

type SecretPattern struct {
	Name        string
	Description string
	Severity    string
	Regex       *regexp.Regexp
}

SecretPattern represents a pattern for detecting secrets.

Jump to

Keyboard shortcuts

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