Documentation
¶
Index ¶
- Constants
- func NewDefaultScanner() secrets.Scanner
- func NewEmptyScanner() secrets.Scanner
- func NewScanner(transformers []secrets.Transformer, detectors []secrets.Detector, ...) secrets.Scanner
- func NewScannerFromConfig(config Config) (secrets.Scanner, error)
- type Config
- type ConfigBuilder
- func (builder ConfigBuilder) AppendDetectors(detectors ...string) ConfigBuilder
- func (builder ConfigBuilder) AppendTransformers(transformers ...string) ConfigBuilder
- func (builder ConfigBuilder) Build() Config
- func (builder ConfigBuilder) RemoveDetectors(detectors ...string) ConfigBuilder
- func (builder ConfigBuilder) RemoveTransformers(transformers ...string) ConfigBuilder
- func (builder ConfigBuilder) SetThreshold(thresholdInBytes int) ConfigBuilder
Constants ¶
View Source
const (
DefaultThreshold int = 10 * 1e6 // 10MB
)
View Source
const (
SizeThresholdViolationType = "Suspicious text file size"
)
Variables ¶
This section is empty.
Functions ¶
func NewDefaultScanner ¶
func NewEmptyScanner ¶
func NewScanner ¶
Types ¶
type Config ¶
type Config struct { Transformers []string `json:"transformers" yaml:"transformers"` Detectors []string `json:"detectors" yaml:"detectors"` DetectorConfigs map[string][]string `json:"detectors_configs" yaml:"detectors_configs"` ThresholdInBytes int `json:"threshold_in_bytes" yaml:"threshold_in_bytes"` }
Config represents a scanner configuration. Omitted fields will preserve the values of the default configuration.
Notice: filesTransformers order may affect the results, because the algorithm breaks on first successful transform. So it's better to order them from most specific to the most general. e.g. json is usually a legal yaml, but not vice versa. Hence, json is more specific.
yaml is usually a valid ini, but usually not vice versa. Hence, yaml is more specific.
Notice 2: detectors order may affect the results, because the algorithm breaks on first detection for single line input. So it's better to order them from most specific to the most general. e.g. GitHub key might also be a high entropy base64 string.
func NewConfigWithDefaults ¶
func NewConfigWithDefaults() Config
type ConfigBuilder ¶
type ConfigBuilder struct {
// contains filtered or unexported fields
}
func NewConfigBuilder ¶
func NewConfigBuilder() ConfigBuilder
func NewConfigBuilderFrom ¶
func NewConfigBuilderFrom(config Config) ConfigBuilder
func (ConfigBuilder) AppendDetectors ¶
func (builder ConfigBuilder) AppendDetectors(detectors ...string) ConfigBuilder
func (ConfigBuilder) AppendTransformers ¶
func (builder ConfigBuilder) AppendTransformers(transformers ...string) ConfigBuilder
func (ConfigBuilder) Build ¶
func (builder ConfigBuilder) Build() Config
func (ConfigBuilder) RemoveDetectors ¶
func (builder ConfigBuilder) RemoveDetectors(detectors ...string) ConfigBuilder
func (ConfigBuilder) RemoveTransformers ¶
func (builder ConfigBuilder) RemoveTransformers(transformers ...string) ConfigBuilder
func (ConfigBuilder) SetThreshold ¶
func (builder ConfigBuilder) SetThreshold(thresholdInBytes int) ConfigBuilder
Click to show internal directories.
Click to hide internal directories.