secrets

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

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