config

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ExitCodeBlockingError = 1

ExitCodeBlockingError should be returned the scanner is completely inoperable. For example, the config is broken or it can't pull patterns for the first time.

Variables

This section is empty.

Functions

func RemovePatternServerAuthToken

func RemovePatternServerAuthToken() error

RemovePatternServerAuthToken deletes the auth token

func SavePatternServerAuthToken

func SavePatternServerAuthToken(authToken string) error

SavePatternServerAuthToken saves the token in the path where it should go

Types

type Config

type Config struct {
	Logger  Logger  `toml:"logger"`
	Scanner Scanner `toml:"scanner"`
}

Config provides a general structure to capture the config options for the toolchain. This may be abstracted out to a common library in the future as more components are added to the toolchain.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig provides a fully usable instance of Config with default values provided

func LoadConfigFromFile

func LoadConfigFromFile(path string) (*Config, error)

LoadConfigFromFile provides a config object with default values set plus any custom values pulled in from the config file

func LocateAndLoadConfig

func LocateAndLoadConfig(path string) (*Config, error)

LocateAndLoadConfig looks through the possible places for the config favoring the provided path if it is set

type Gitleaks

type Gitleaks struct {
	Version    string `toml:"version"`
	ConfigPath string `toml:"config_path"`
}

Gitleaks holds version and config information for the Gitleaks scanner

type Logger

type Logger struct {
	Level string `toml:"level"`
}

Logger provides general logger config

type PatternServer

type PatternServer struct {
	AuthToken string `toml:"auth_token"`
	URL       string `toml:"url"`
}

PatternServer provides pattern server configuration settings for the scanner

type Patterns

type Patterns struct {
	Autofetch    bool          `toml:"autofetch"`
	ExpiredAfter uint32        `toml:"expired_after"`
	Gitleaks     Gitleaks      `toml:"gitleaks"`
	RefreshAfter uint32        `toml:"refresh_after"`
	Server       PatternServer `toml:"server"`
}

Patterns provides configuration for managing pattern updates

type Scanner

type Scanner struct {
	CloneTimeout        uint16   `toml:"clone_timeout"`
	CloneWorkers        uint16   `toml:"clone_workers"`
	IncludeResponseLogs bool     `toml:"include_response_logs"`
	MaxDecodeDepth      uint16   `toml:"max_decode_depth"`
	MaxScanDepth        uint16   `toml:"max_scan_depth"`
	Patterns            Patterns `toml:"patterns"`
	ScanWorkers         uint16   `toml:"scan_workers"`
	Workdir             string   `toml:"workdir"`
}

Scanner provides scanner specific config

Jump to

Keyboard shortcuts

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