config.tmpl 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. regex = '''{{$rule.Regex}}'''
  29. {{- with $rule.Path }}
  30. path = '''{{ . }}'''{{ end -}}
  31. {{- with $rule.SecretGroup }}
  32. secretGroup = {{ . }}{{ end -}}
  33. {{- with $rule.Entropy }}
  34. entropy = {{ . }}{{ end -}}
  35. {{- with $rule.Keywords }}
  36. {{- if gt (len .) 1}}
  37. keywords = [{{ range $j, $keyword := . }}
  38. "{{ $keyword }}",{{ end }}
  39. ]{{else}}
  40. keywords = [{{ range $j, $keyword := . }}"{{ $keyword }}"{{ end }}]{{end}}{{ end }}
  41. {{- with $rule.Tags }}
  42. tags = [
  43. {{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
  44. ]{{ end }}
  45. {{- with $rule.Allowlists }}{{ range $i, $allowlist := . }}{{ if or $allowlist.Regexes $allowlist.Paths $allowlist.Commits $allowlist.StopWords }}{{println}}[[rules.allowlists]]
  46. {{- with .MatchCondition }}{{println}}condition = "{{ .MatchCondition.String }}"{{ end }}
  47. {{- with .Commits -}}{{println}}commits = [
  48. {{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
  49. ]{{ end }}
  50. {{- with .Paths }}{{println}}paths = [
  51. {{ range $j, $path := . }}'''{{ $path }}''',{{ end }}
  52. ]{{ end }}
  53. {{- if and .RegexTarget .Regexes }}{{println}}regexTarget = "{{ .RegexTarget }}"{{ end -}}
  54. {{- with .Regexes }}{{println}}regexes = [{{ range $i, $regex := . }}
  55. '''{{ $regex }}''',{{ end }}
  56. ]{{ end }}
  57. {{- with .StopWords }}{{println}}stopwords = [{{ range $j, $stopword := . }}
  58. "{{ $stopword }}",{{ end }}
  59. ]{{ end }}{{ end }}{{ end }}{{ end }}
  60. {{ end }}