config.tmpl 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. # This is the default gitleaks configuration file.
  6. # Rules and allowlists are defined within this file.
  7. # Rules instruct gitleaks on what should be considered a secret.
  8. # Allowlists instruct gitleaks on what is allowed, i.e. not a secret.
  9. title = "{{.Title}}"
  10. [allowlist]
  11. description = "{{.Allowlist.Description}}"
  12. {{- with .Allowlist.RegexTarget }}
  13. regexTarget = "{{ . }}"{{ end -}}
  14. {{- with .Allowlist.Regexes }}
  15. regexes = [{{ range $i, $regex := . }}
  16. '''{{ $regex }}''',{{ end }}
  17. ]{{ end }}
  18. {{- with .Allowlist.Paths }}
  19. paths = [{{ range $i, $path := . }}
  20. '''{{ $path }}''',{{ end }}
  21. ]{{ end }}
  22. {{- with .Allowlist.StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  23. "{{ $stopword }}",{{ end }}
  24. ]{{ end }}{{println}}
  25. {{- range $i, $rule := .Rules }}{{println}}[[rules]]
  26. id = "{{$rule.RuleID}}"
  27. description = "{{$rule.Description}}"
  28. {{- with $rule.Regex }}
  29. regex = '''{{ . }}'''{{ end -}}
  30. {{- with $rule.Path }}
  31. path = '''{{ . }}'''{{ end -}}
  32. {{- with $rule.SecretGroup }}
  33. secretGroup = {{ . }}{{ end -}}
  34. {{- with $rule.Entropy }}
  35. entropy = {{ . }}{{ end -}}
  36. {{- with $rule.Keywords }}
  37. {{- if gt (len .) 1}}
  38. keywords = [{{ range $j, $keyword := . }}
  39. "{{ $keyword }}",{{ end }}
  40. ]{{else}}
  41. keywords = [{{ range $j, $keyword := . }}"{{ $keyword }}"{{ end }}]{{end}}{{ end }}
  42. {{- with $rule.Tags }}
  43. tags = [
  44. {{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
  45. ]{{ end }}
  46. {{- with $rule.Allowlists }}{{ range $i, $allowlist := . }}{{ if or $allowlist.Regexes $allowlist.Paths $allowlist.Commits $allowlist.StopWords }}{{println}}[[rules.allowlists]]
  47. {{- with .MatchCondition }}{{println}}condition = "{{ .MatchCondition.String }}"{{ end }}
  48. {{- with .Commits -}}{{println}}commits = [
  49. {{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
  50. ]{{ end }}
  51. {{- with .Paths }}{{println}}paths = [
  52. {{ range $j, $path := . }}'''{{ $path }}''',{{ end }}
  53. ]{{ end }}
  54. {{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
  55. {{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
  56. '''{{ $regex }}''',{{ end }}
  57. ]{{ end }}
  58. {{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  59. "{{ $stopword }}",{{ end }}
  60. ]{{ end }}{{ end }}{{ end }}{{ end }}
  61. {{ end }}