config.tmpl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # This file has been auto-generated. Do not edit manually.
  2. # If you would like to contribute new rules, please use
  3. # cmd/generate/config/main.go and follow the contributing guidelines
  4. # at https://github.com/gitleaks/gitleaks/blob/master/CONTRIBUTING.md
  5. #
  6. # How the hell does secret scanning work? Read this:
  7. # https://lookingatcomputer.substack.com/p/regex-is-almost-all-you-need
  8. #
  9. # This is the default gitleaks configuration file.
  10. # Rules and allowlists are defined within this file.
  11. # Rules instruct gitleaks on what should be considered a secret.
  12. # Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
  13. title = "{{.Title}}"
  14. # minVersion indicates the minimum Gitleaks version required to use this config.
  15. # If the running version is older, a warning will be logged and not all
  16. # config-enabled features are guaranteed to work.
  17. minVersion = "v8.25.0"
  18. {{ with .Allowlists }}{{ range $i, $allowlist := . }}{{ if or $allowlist.Regexes $allowlist.Paths $allowlist.Commits $allowlist.StopWords }}# TODO: change to [[allowlists]]{{println}}[allowlist]
  19. {{- with .Description }}{{println}}description = "{{ . }}"{{ end }}
  20. {{- with .MatchCondition }}{{println}}condition = "{{ .String }}"{{ end }}
  21. {{- with .Commits -}}{{println}}commits = [
  22. {{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
  23. ]{{ end }}
  24. {{- with .Paths }}{{println}}paths = [{{ range $j, $path := . }}
  25. '''{{ $path }}''',{{ end }}
  26. ]{{ end }}
  27. {{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
  28. {{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
  29. '''{{ $regex }}''',{{ end }}
  30. ]{{ end }}
  31. {{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  32. "{{ $stopword }}",{{ end }}
  33. ]{{ end }}{{ end }}{{ end }}{{ end }}{{println}}
  34. {{- range $i, $rule := .Rules }}{{println}}[[rules]]
  35. id = "{{$rule.RuleID}}"
  36. description = "{{$rule.Description}}"
  37. {{- with $rule.Regex }}
  38. regex = '''{{ . }}'''{{ end -}}
  39. {{- with $rule.Path }}
  40. path = '''{{ . }}'''{{ end -}}
  41. {{- with $rule.SecretGroup }}
  42. secretGroup = {{ . }}{{ end -}}
  43. {{- with $rule.Entropy }}
  44. entropy = {{ . }}{{ end -}}
  45. {{- with $rule.Keywords }}
  46. {{- if gt (len .) 1}}
  47. keywords = [{{ range $j, $keyword := . }}
  48. "{{ $keyword }}",{{ end }}
  49. ]{{else}}
  50. keywords = [{{ range $j, $keyword := . }}"{{ $keyword }}"{{ end }}]{{end}}{{ end }}
  51. {{- with $rule.Tags }}
  52. tags = [
  53. {{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
  54. ]{{ end }}
  55. {{- with $rule.Allowlists }}{{ range $i, $allowlist := . }}{{ if or $allowlist.Regexes $allowlist.Paths $allowlist.Commits $allowlist.StopWords }}{{println}}[[rules.allowlists]]
  56. {{- with .Description }}{{println}}description = "{{ . }}"{{ end }}
  57. {{- with .MatchCondition }}{{println}}condition = "{{ .String }}"{{ end }}
  58. {{- with .Commits -}}{{println}}commits = [
  59. {{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
  60. ]{{ end }}
  61. {{- with .Paths }}{{println}}paths = [
  62. {{ range $j, $path := . }}'''{{ $path }}''',{{ end }}
  63. ]{{ end }}
  64. {{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
  65. {{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
  66. '''{{ $regex }}''',{{ end }}
  67. ]{{ end }}
  68. {{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  69. "{{ $stopword }}",{{ end }}
  70. ]{{ end }}{{ end }}{{ end }}{{ end }}
  71. {{ end }}