config

package
v8.2.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2022 License: MIT Imports: 5 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig string

Functions

This section is empty.

Types

type Allowlist

type Allowlist struct {
	Description string
	Regexes     []*regexp.Regexp
	Paths       []*regexp.Regexp
	Commits     []string
}

func (*Allowlist) CommitAllowed

func (a *Allowlist) CommitAllowed(c string) bool

func (*Allowlist) PathAllowed

func (a *Allowlist) PathAllowed(path string) bool

func (*Allowlist) RegexAllowed

func (a *Allowlist) RegexAllowed(s string) bool

type Config

type Config struct {
	Path        string
	Description string
	Rules       []*Rule
	Allowlist   Allowlist
}

Config is a configuration struct that contains rules and an allowlist if present.

type Rule

type Rule struct {
	Description string
	RuleID      string
	Entropy     float64
	SecretGroup int
	Regex       *regexp.Regexp
	Path        *regexp.Regexp
	Tags        []string
	Allowlist   Allowlist
}

func (*Rule) EntropySet

func (r *Rule) EntropySet() bool

func (*Rule) IncludeEntropy

func (r *Rule) IncludeEntropy(secret string) (bool, float64)

type ViperConfig

type ViperConfig struct {
	Description string
	Rules       []struct {
		ID          string
		Description string
		Entropy     float64
		SecretGroup int
		Regex       string
		Path        string
		Tags        []string

		Allowlist struct {
			Regexes []string
			Paths   []string
			Commits []string
		}
	}
	Allowlist struct {
		Regexes []string
		Paths   []string
		Commits []string
	}
}

ViperConfig is the config struct used by the Viper config package to parse the config file. This struct does not include regular expressions. It is used as an intermediary to convert the Viper config to the Config struct.

func (*ViperConfig) Translate

func (vc *ViperConfig) Translate() (Config, error)

Jump to

Keyboard shortcuts

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