config.tmpl 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. {{ with .Allowlists }}{{ range $i, $allowlist := . }}{{ if or $allowlist.Regexes $allowlist.Paths $allowlist.Commits $allowlist.StopWords }}# TODO: change to [[allowlists]]{{println}}[allowlist]
  15. {{- with .Description }}{{println}}description = "{{ . }}"{{ end }}
  16. {{- with .MatchCondition }}{{println}}condition = "{{ .String }}"{{ end }}
  17. {{- with .Commits -}}{{println}}commits = [
  18. {{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
  19. ]{{ end }}
  20. {{- with .Paths }}{{println}}paths = [{{ range $j, $path := . }}
  21. '''{{ $path }}''',{{ end }}
  22. ]{{ end }}
  23. {{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
  24. {{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
  25. '''{{ $regex }}''',{{ end }}
  26. ]{{ end }}
  27. {{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  28. "{{ $stopword }}",{{ end }}
  29. ]{{ end }}{{ end }}{{ end }}{{ end }}{{println}}
  30. {{- range $i, $rule := .Rules }}{{println}}[[rules]]
  31. id = "{{$rule.RuleID}}"
  32. description = "{{$rule.Description}}"
  33. {{- with $rule.Regex }}
  34. regex = '''{{ . }}'''{{ end -}}
  35. {{- with $rule.Path }}
  36. path = '''{{ . }}'''{{ end -}}
  37. {{- with $rule.SecretGroup }}
  38. secretGroup = {{ . }}{{ end -}}
  39. {{- with $rule.Entropy }}
  40. entropy = {{ . }}{{ end -}}
  41. {{- with $rule.Keywords }}
  42. {{- if gt (len .) 1}}
  43. keywords = [{{ range $j, $keyword := . }}
  44. "{{ $keyword }}",{{ end }}
  45. ]{{else}}
  46. keywords = [{{ range $j, $keyword := . }}"{{ $keyword }}"{{ end }}]{{end}}{{ end }}
  47. {{- with $rule.Tags }}
  48. tags = [
  49. {{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
  50. ]{{ end }}
  51. {{- with $rule.Allowlists }}{{ range $i, $allowlist := . }}{{ if or $allowlist.Regexes $allowlist.Paths $allowlist.Commits $allowlist.StopWords }}{{println}}[[rules.allowlists]]
  52. {{- with .Description }}{{println}}description = "{{ . }}"{{ end }}
  53. {{- with .MatchCondition }}{{println}}condition = "{{ .String }}"{{ end }}
  54. {{- with .Commits -}}{{println}}commits = [
  55. {{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
  56. ]{{ end }}
  57. {{- with .Paths }}{{println}}paths = [
  58. {{ range $j, $path := . }}'''{{ $path }}''',{{ end }}
  59. ]{{ end }}
  60. {{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
  61. {{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
  62. '''{{ $regex }}''',{{ end }}
  63. ]{{ end }}
  64. {{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  65. "{{ $stopword }}",{{ end }}
  66. ]{{ end }}{{ end }}{{ end }}{{ end }}
  67. {{ end }}