Documentation
¶
Index ¶
- Constants
- func ParseGitleaksConfig(rawConfig string) (glc *gitleaksconfig.Config, err error)
- type Backend
- type Contact
- type ErrorCode
- type Gitleaks
- type HTTPClient
- type LeakTKError
- type Location
- type Patterns
- type Point
- type Request
- type RequestDetails
- type Response
- type Result
- type Rule
- type Scanner
Constants ¶
const ( // NoErrorCode means the error code hasn't been set NoErrorCode = iota // CloneError means we were unable to successfully clone the resource CloneError // ScanError means there was some issue scanning the cloned resource ScanError // ResourceCleanupError means we couldn't remove the resources that were cloned after a scan ResourceCleanupError )
const ( GeneralResultKind = "General" GitCommitResultKind = "GitCommit" JSONDataResultKind = "JSONData" )
In the future we might have things like GitCommitMessage GithubPullRequest, etc
Variables ¶
This section is empty.
Functions ¶
func ParseGitleaksConfig ¶
func ParseGitleaksConfig(rawConfig string) (glc *gitleaksconfig.Config, err error)
ParseGitleaksConfig takes a gitleaks config string and returns a config object
Types ¶
type ErrorCode ¶
type ErrorCode int
ErrorCode defined sthe set of error codes that can be set on a LeakTKError
type Gitleaks ¶
type Gitleaks struct {
// contains filtered or unexported fields
}
Gitleaks wraps gitleaks as a scanner backend
func NewGitleaks ¶
NewGitleaks returns a configured gitleaks backend instance
type HTTPClient ¶
HTTPClient provides an interface for working with Go's http client or swapping it out with other types for testing
type LeakTKError ¶
type LeakTKError struct { Fatal bool `json:"fatal"` Code ErrorCode `json:"code"` Message string `json:"message"` }
LeakTKError expans a normal error to provide additional meta data
func (LeakTKError) Error ¶
func (e LeakTKError) Error() string
Error is defined to implement the error interface
func (LeakTKError) String ¶
func (e LeakTKError) String() string
String provides a string representation of the error
type Location ¶
type Location struct { // This can be things like a commit or some other version control identifier Version string `json:"version"` Path string `json:"path"` // If the start column isn't available it will be zero. Start Point `json:"start"` // If the end information isn't available it will be the same as the // start information but the colmn will be the end of the line End Point `json:"end"` }
Location in the specific resource being scanned
type Patterns ¶
type Patterns struct {
// contains filtered or unexported fields
}
Patterns acts as an abstraction for fetching different scanner patterns and keeping them up to date and cached
func NewPatterns ¶
func NewPatterns(cfg *config.Patterns, client HTTPClient) *Patterns
NewPatterns returns a configured instance of Patterns
func (*Patterns) Gitleaks ¶
func (p *Patterns) Gitleaks() (*gitleaksconfig.Config, error)
Gitleaks returns a Gitleaks config object if it's able to
func (*Patterns) GitleaksConfigHash ¶ added in v0.0.2
GitleaksConfigHash returns the sha256 hash for the current gitleaks config
type Request ¶
type Request struct { ID string // Thing to scan (e.g. URL, snippet of text, etc) Resource resource.Resource Errors []LeakTKError }
Request to the scanner to scan some resource
func (*Request) UnmarshalJSON ¶
UnmarshalJSON sets r to a copy of data
type RequestDetails ¶
type RequestDetails struct { ID string `json:"id"` Kind string `json:"kind"` Resource string `json:"resource"` }
RequestDetails that we return with the response for tying the two together
type Response ¶
type Response struct { ID string `json:"id"` Errors []LeakTKError `json:"errors"` Request RequestDetails `json:"request"` Results []*Result `json:"results"` }
Response from the scanner with the scan results
type Result ¶
type Result struct { ID string `json:"id"` Kind string `json:"kind"` Secret string `json:"secret"` Match string `json:"match"` Entropy float32 `json:"entropy"` Date string `json:"date"` Rule Rule `json:"rule"` Contact Contact `json:"contact"` Location Location `json:"location"` Notes map[string]string `json:"notes"` }
Result of a scan
type Rule ¶
type Rule struct { ID string `json:"id"` Description string `json:"description"` Tags []string `json:"tags"` }
Rule that triggered the result
type Scanner ¶
type Scanner struct {
// contains filtered or unexported fields
}
Scanner holds the config and state for the scanner processes
func NewScanner ¶
NewScanner returns a initialized and listening scanner instance that should be closed when it's no longer needed.