security

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package security provides secret detection and redaction for extracted code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	// FilePath is the file where the secret was found.
	FilePath string

	// PatternName is the name of the matched pattern.
	PatternName string
}

Finding represents a single secret detection finding.

type Pattern

type Pattern struct {
	// Name is a human-readable name for the pattern.
	Name string

	// Regex is the compiled regular expression.
	Regex *regexp.Regexp
}

Pattern represents a secret detection pattern.

type ScanResult

type ScanResult struct {
	// Findings is the list of detected secrets.
	Findings []Finding

	// RedactedFiles is the extract result with secrets redacted.
	RedactedFiles []extractor.ExtractedFile
}

ScanResult contains the results of a security scan.

type Scanner

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

Scanner detects and redacts secrets in extracted code.

func NewScanner

func NewScanner(warnings io.Writer) *Scanner

NewScanner creates a new Scanner with default patterns. Warnings are written to the given writer (typically os.Stderr).

func (*Scanner) Scan

func (s *Scanner) Scan(result *extractor.ExtractResult) *ScanResult

Scan scans extracted files for secrets, redacts them, and returns findings.

func (*Scanner) SetWarnings

func (s *Scanner) SetWarnings(w io.Writer)

SetWarnings sets the writer for warning output.

Jump to

Keyboard shortcuts

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