security

package
v1.3.187 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatWarnings

func FormatWarnings(findings []Finding) string

FormatWarnings formats findings into a human-readable warning string suitable for appending to a tool result.

Types

type Finding

type Finding struct {
	PatternID string
	Name      string
	Severity  string
	Line      int    // 1-based line number
	Match     string // the matched text (may be partially masked in output)
}

Finding represents a single detected secret occurrence.

func ScanForSecrets

func ScanForSecrets(filePath, content string) []Finding

ScanForSecrets scans content for known secret patterns and returns findings. filePath is used to skip allowlisted files (test fixtures, examples, etc.).

func (Finding) Sprintf

func (f Finding) Sprintf() string

Sprintf returns a formatted single-line description of a finding.

type SecretPattern

type SecretPattern struct {
	ID                string
	Name              string
	Severity          string // "high", "medium", "low"
	Pattern           *regexp.Regexp
	CheckPlaceholders bool // if true, skip values that look like placeholders
}

SecretPattern defines a detectable secret type.

Jump to

Keyboard shortcuts

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