Documentation
¶
Index ¶
- Variables
- func ForceOverwriteTrufflehogConfig(configFilePath string, config Config) error
- func HandleScannerConfig(logger hclog.Logger, excludePaths []string, targetFolder string, ...) error
- func JsonToPlainReport(filePath string) (string, error)
- func JsonToSarifReport(filePath string) (string, error)
- func SaveConfig(path string, config Config) error
- func WrapDecodeFailure(err error) error
- func WriteDefaultTrufflehogConfigIfMissing(logger hclog.Logger, configFilePath string) error
- type Config
- type Exclude
- type Trufflehog3Issue
- type Trufflehog3Report
- type Trufflehog3Rule
Constants ¶
This section is empty.
Variables ¶
var ErrDecodeFailure = errors.New("failed to decode .trufflehog3.yml configuration file")
Functions ¶
func ForceOverwriteTrufflehogConfig ¶ added in v0.3.0
ForceOverwriteTrufflehogConfig forcefully overwrites the existing configuration with the provided configuration.
func HandleScannerConfig ¶ added in v0.3.0
func HandleScannerConfig(logger hclog.Logger, excludePaths []string, targetFolder string, writeDefaultIfMissing bool, forceOverwrite bool) error
HandleScannerConfig processes the scanner configuration, including writing default configs or overwriting existing ones.
func JsonToPlainReport ¶ added in v0.3.0
JsonToPlainReport converts a Trufflehog3 JSON report to a plain text format.
func JsonToSarifReport ¶ added in v0.3.0
JsonToSarifReport converts a Trufflehog3 JSON report to SARIF format.
func SaveConfig ¶ added in v0.3.0
SaveConfig saves the YAML configuration to the specified file.
func WrapDecodeFailure ¶ added in v0.3.0
WrapDecodeFailure adds context to ErrDecodeFailure
func WriteDefaultTrufflehogConfigIfMissing ¶ added in v0.3.0
WriteDefaultTrufflehogConfigIfMissing writes the default configuration if the file is missing.
Types ¶
type Config ¶ added in v0.3.0
type Config struct { Exclude []*Exclude `yaml:"exclude"` Severity string `yaml:"severity,omitempty"` IgnoreNoSecret bool `yaml:"ignore_nosecret,omitempty"` NoEntropy bool `yaml:"no_entropy,omitempty"` NoPattern bool `yaml:"no_pattern,omitempty"` Branch string `yaml:"branch,omitempty"` Depth int `yaml:"depth,omitempty"` Since string `yaml:"since,omitempty"` NoCurrent bool `yaml:"no_current,omitempty"` NoHistory bool `yaml:"no_history,omitempty"` Context int `yaml:"context,omitempty"` }
Config represents the entire YAML configuration.
func DefaultConfig ¶ added in v0.3.0
func DefaultConfig() Config
DefaultConfig returns the default configuration for Trufflehog3. TODO: move fetching default from a file
func LoadConfig ¶ added in v0.3.0
LoadConfig loads the YAML configuration from the specified file.
type Exclude ¶ added in v0.3.0
type Exclude struct { Message string `yaml:"message"` Paths []string `yaml:"paths,omitempty"` Pattern string `yaml:"pattern,omitempty"` ID string `yaml:"id,omitempty"` }
Exclude represents each exclusion rule in the configuration.
type Trufflehog3Issue ¶
type Trufflehog3Issue struct { Rule *Trufflehog3Rule `json:"rule"` Path string `json:"path"` Line string `json:"line"` Secret string `json:"secret"` ID string `json:"id,omitempty"` Branch string `json:"branch,omitempty"` Commit string `json:"commit,omitempty"` Author string `json:"author,omitempty"` Date string `json:"date,omitempty"` }
Trufflehog3Issue represents a single issue found by Trufflehog3.
type Trufflehog3Report ¶
type Trufflehog3Report []*Trufflehog3Issue
Trufflehog3Report represents a collection of Trufflehog3 issues.
func (Trufflehog3Report) Deduplicate ¶ added in v0.3.0
func (report Trufflehog3Report) Deduplicate() Trufflehog3Report
Deduplicate removes duplicate issues from the report.
func (Trufflehog3Report) Render ¶
func (report Trufflehog3Report) Render() string
Render produces a human-readable report of the Trufflehog3 issues.