Documentation ¶
Index ¶
- func FindSecret(source io.Reader, matcher MatchProvider, shouldProvideSourceInDiagnostics bool) chan diagnostics.SecurityDiagnostic
- func SearchSecretsOnPaths(paths []string, showSource bool, wl diagnostics.DefaultWhitelistProvider) chan diagnostics.SecurityDiagnostic
- type MatchProvider
- func GetFinderForFileType(fileType string) MatchProvider
- func NewCPPSecretsFinders() MatchProvider
- func NewConfigurationSecretsFinder() MatchProvider
- func NewERubySecretsFinders() MatchProvider
- func NewJSONSecretsFinders() MatchProvider
- func NewJavaFinder() MatchProvider
- func NewRubySecretsFinders() MatchProvider
- func NewXMLSecretsFinders() MatchProvider
- func NewYamlSecretsFinders() MatchProvider
- type RegexFinder
- func (finder *RegexFinder) Consume(startIndex int, source string)
- func (finder *RegexFinder) End()
- func (finder RegexFinder) GetRegularExpressions() []*regexp.Regexp
- func (finder *RegexFinder) SetLineKeeper(lk *util.LineKeeper)
- func (finder *RegexFinder) ShouldProvideSourceInDiagnostics(provideSource bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FindSecret ¶
func FindSecret(source io.Reader, matcher MatchProvider, shouldProvideSourceInDiagnostics bool) chan diagnostics.SecurityDiagnostic
FindSecret locates secrets contained in a source that implements `io.Reader` interface using a `MatchProvider`
func SearchSecretsOnPaths ¶ added in v0.0.4
func SearchSecretsOnPaths(paths []string, showSource bool, wl diagnostics.DefaultWhitelistProvider) chan diagnostics.SecurityDiagnostic
SearchSecretsOnPaths searches for secrets on indicated paths
Types ¶
type MatchProvider ¶
type MatchProvider interface { // common.WhitelistProvider GetFinders() []common.SourceToSecurityDiagnostics }
MatchProvider provides regular expressions and other facilities for locating secrets in source data
func GetFinderForFileType ¶
func GetFinderForFileType(fileType string) MatchProvider
GetFinderForFileType returns the appropriate MatchProvider based on the file type hint
func NewCPPSecretsFinders ¶
func NewCPPSecretsFinders() MatchProvider
NewCPPSecretsFinders is a `MatchProvider` for finding secrets in files with C++-like content
func NewConfigurationSecretsFinder ¶
func NewConfigurationSecretsFinder() MatchProvider
NewConfigurationSecretsFinder is a `MatchProvider` for finding secrets in configuration `.conf` files
func NewERubySecretsFinders ¶
func NewERubySecretsFinders() MatchProvider
NewERubySecretsFinders is a `MatchProvider` for finding secrets in files with ERuby content
func NewJSONSecretsFinders ¶
func NewJSONSecretsFinders() MatchProvider
NewJSONSecretsFinders is a `MatchProvider` for finding secrets in files with JSON content
func NewJavaFinder ¶
func NewJavaFinder() MatchProvider
NewJavaFinder provides secret detection in Java-like programming languages
func NewRubySecretsFinders ¶
func NewRubySecretsFinders() MatchProvider
NewRubySecretsFinders is a `MatchProvider` for finding secrets in files with Ruby content
func NewXMLSecretsFinders ¶
func NewXMLSecretsFinders() MatchProvider
NewXMLSecretsFinders is a `MatchProvider` for finding secrets in files with XML content
func NewYamlSecretsFinders ¶
func NewYamlSecretsFinders() MatchProvider
NewYamlSecretsFinders is a `MatchProvider` for finding secrets in files with YAML content
type RegexFinder ¶
type RegexFinder struct { diagnostics.DefaultSecurityDiagnosticsProvider // contains filtered or unexported fields }
RegexFinder provides secret detection using regular expressions
func (*RegexFinder) Consume ¶
func (finder *RegexFinder) Consume(startIndex int, source string)
Consume allows a source processor receive `source` data streamed in "chunks", with `startIndex` indicating the character location of the first character in the stream
func (*RegexFinder) End ¶
func (finder *RegexFinder) End()
End is used to signal to the consumer that the source stream has ended
func (RegexFinder) GetRegularExpressions ¶
func (finder RegexFinder) GetRegularExpressions() []*regexp.Regexp
GetRegularExpressions returns the underlying compiled regular expressions
func (*RegexFinder) SetLineKeeper ¶
func (finder *RegexFinder) SetLineKeeper(lk *util.LineKeeper)
SetLineKeeper allows this source consumer to keep track of `code.Position`
func (*RegexFinder) ShouldProvideSourceInDiagnostics ¶
func (finder *RegexFinder) ShouldProvideSourceInDiagnostics(provideSource bool)
ShouldProvideSourceInDiagnostics toggles whether source evidence should be provided with diagnostics, defaults to false