rule.go 963 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package config
  2. import (
  3. "regexp"
  4. )
  5. // Rules contain information that define details on how to detect secrets
  6. type Rule struct {
  7. // Description is the description of the rule.
  8. Description string
  9. // RuleID is a unique identifier for this rule
  10. RuleID string
  11. // Entropy is a float representing the minimum shannon
  12. // entropy a regex group must have to be considered a secret.
  13. Entropy float64
  14. // SecretGroup is an int used to extract secret from regex
  15. // match and used as the group that will have its entropy
  16. // checked if `entropy` is set.
  17. SecretGroup int
  18. // Regex is a golang regular expression used to detect secrets.
  19. Regex *regexp.Regexp
  20. // Path is a golang regular expression used to
  21. // filter secrets by path
  22. Path *regexp.Regexp
  23. // Tags is an array of strings used for metadata
  24. // and reporting purposes.
  25. Tags []string
  26. // Allowlist allows a rule to be ignored for specific
  27. // regexes, paths, and/or commits
  28. Allowlist Allowlist
  29. }