config.tmpl 2.6 KB

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