Documentation
¶
Overview ¶
Package config handles loading and defaulting envaudit's configuration.
envaudit intentionally avoids a third-party YAML library so the tool has zero external dependencies and builds anywhere `go build` works. The config file format is a deliberately small subset of YAML: flat "key: value" pairs plus simple "- item" lists under a key. If you need full YAML support, swapping in gopkg.in/yaml.v3 later is a small change contained entirely to this file.
Index ¶
Constants ¶
const ExampleYAML = `` /* 911-byte string literal not displayed */
ExampleYAML is written out by `envaudit init`.
Variables ¶
var ValidSeverityExitCodes = []string{"ok", "low", "medium", "high", "critical"}
ValidSeverityExitCodes is the set of values accepted by Validate and understood by --strict / severity_exit_code.
Functions ¶
This section is empty.
Types ¶
type AllowlistEntry ¶ added in v1.1.0
AllowlistEntry suppresses findings that match ALL of the non-empty fields. A `file` alone silences every finding in that file; adding `rule`, `line`, and/or `key` narrows the suppression further. This is how known false positives get a checked-in baseline instead of disabling a whole rule.
type Config ¶
type Config struct {
// EntropyThreshold is the Shannon entropy (bits/char) above which a
// value is considered "random enough" to be a real secret.
EntropyThreshold float64
// IgnorePatterns are filename globs (matched with filepath.Match)
// that envaudit should skip entirely, e.g. "*.env.sample".
IgnorePatterns []string
// SeverityExitCode is the minimum severity that causes `envaudit scan`
// to exit non-zero. One of: low, medium, high, critical.
SeverityExitCode string
// CustomSecretPatterns are extra regex rules merged with the built-in
// pattern set in internal/rules.
CustomSecretPatterns []CustomPattern
// Allowlist suppresses matching findings — the baseline for accepted
// false positives. See AllowlistEntry.
Allowlist []AllowlistEntry
}
Config holds all tunable behavior for envaudit.
func Default ¶
func Default() *Config
Default returns envaudit's out-of-the-box configuration. This is what runs when no .envaudit.yml is present, so it must be sane on its own.
func Load ¶
Load reads a .envaudit.yml-style file at path and merges it on top of Default(). Missing keys fall back to defaults. If path does not exist, Load returns Default() with no error, so callers can always call Load unconditionally.
type CustomPattern ¶
CustomPattern lets users define additional secret-detection regexes without recompiling envaudit.