Documentation
¶
Index ¶
- func IsTextFile(path string) bool
- func MaskAll(content string) string
- func MaskLine(line string) string
- func MaskSecretKeyBlocks(content string) string
- type RuleSet
- func (r *RuleSet) AddAllowed(pattern string) error
- func (r *RuleSet) AddPattern(pattern string) error
- func (r *RuleSet) ScanDir(root string, recursive bool) ([]SecretMatch, error)
- func (r *RuleSet) ScanFile(path string) ([]SecretMatch, error)
- func (r *RuleSet) ScanReader(rd io.Reader, filename string) ([]SecretMatch, error)
- type SecretMatch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTextFile ¶
IsTextFile returns true if a file is likely to be a text file.
func MaskAll ¶
MaskAll applies secret key block masking (multiline) then per-line masking (password, tokens, etc).
func MaskSecretKeyBlocks ¶
MaskSecretKeyBlocks replaces entire private key PEM/OPENSSH blocks with *****MASKED*****
Types ¶
type RuleSet ¶
type RuleSet struct {
Patterns []*regexp.Regexp // Default+Added patterns (order matters!)
Allowed []*regexp.Regexp
}
RuleSet holds a set of forbidden/allowed patterns.
func DefaultRuleSet ¶
func DefaultRuleSet() *RuleSet
New default ruleset (defaultPatterns at front, then AddPattern, order preserved)
func (*RuleSet) AddAllowed ¶
func (*RuleSet) AddPattern ¶
func (*RuleSet) ScanDir ¶
func (r *RuleSet) ScanDir(root string, recursive bool) ([]SecretMatch, error)
func (*RuleSet) ScanReader ¶
ScanReader returns all matches for forbidden patterns (order=priority!).
Click to show internal directories.
Click to hide internal directories.