secrets

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTextFile

func IsTextFile(path string) bool

func MaskAll

func MaskAll(content string) string

func MaskSecretKeyBlocks

func MaskSecretKeyBlocks(content string) string

Types

type RuleSet

type RuleSet struct {
	FullMaskPatterns []*regexp.Regexp // Default+Added patterns (order matters!)
	Allowed          []*regexp.Regexp
	ValueMaskRules   []*ValueMaskRule
}

func DefaultRuleSet

func DefaultRuleSet() *RuleSet

func (*RuleSet) AddAllowed

func (r *RuleSet) AddAllowed(pattern string) error

func (*RuleSet) AddPattern

func (r *RuleSet) AddPattern(pattern string) error

func (*RuleSet) AddValueMaskKey added in v1.1.5

func (r *RuleSet) AddValueMaskKey(keywordList []string)

func (*RuleSet) ScanDir

func (r *RuleSet) ScanDir(root string, recursive bool) ([]SecretMatch, error)

func (*RuleSet) ScanFile

func (r *RuleSet) ScanFile(path string) ([]SecretMatch, error)

func (*RuleSet) ScanReader

func (r *RuleSet) ScanReader(rd io.Reader, filename string) ([]SecretMatch, error)

type SecretMatch

type SecretMatch struct {
	File    string
	Line    int
	Text    string
	Pattern string
}

type ValueMaskRule added in v1.1.5

type ValueMaskRule struct {
	KeyPattern *regexp.Regexp
}

func (*ValueMaskRule) MaskLine added in v1.1.5

func (r *ValueMaskRule) MaskLine(line string) string

Jump to

Keyboard shortcuts

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