scanfile

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package scanfile detects secrets in local files and editor buffers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NormalizedFinding

type NormalizedFinding struct {
	DetectorClass string `json:"detectorClass"`
	Severity      string `json:"severity"`
	File          string `json:"file"`
	StartLine     int    `json:"startLine"`
	EndLine       int    `json:"endLine"`
	StartColumn   int    `json:"startColumn"`
	EndColumn     int    `json:"endColumn"`
	CWE           string `json:"cwe"`
	Message       string `json:"message"`
	Fingerprint   string `json:"fingerprint"`
}

NormalizedFinding describes a secret without its value. Lines and UTF-16 columns are 1-based. EndColumn includes the last character of the secret.

func ScanContent

func ScanContent(content []byte, filePath string, repository string) []NormalizedFinding

ScanContent scans a file or buffer for secrets without network access. filePath labels each finding and selects path exclusions. repository is part of the fingerprint. Rule names can differ from platform secret types, so fingerprints do not guarantee correlation with platform findings.

type Rule

type Rule struct {
	ID         string
	Regex      *regexp.Regexp
	Keywords   []string
	MinEntropy float64
	Multiline  bool
}

Rule defines a secret pattern and its detection limits.

func (Rule) Title

func (r Rule) Title() string

Title returns the display name for a rule.

Jump to

Keyboard shortcuts

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