mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-12-01 05:24:22 +01:00
feat(config): update template logic (#1201)
This commit is contained in:
1 parent
61513d6772
commit
34e67229e6
2 files changed
+195
-194
No files matched your search
@@ -25,40 +25,39 @@ paths = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
{{ range $i, $rule := .Rules }}[[rules]]
|
{{ range $i, $rule := .Rules }}[[rules]]
|
||||||
{{ if and $rule.SecretGroup $rule.Entropy $rule.Allowlist.StopWords }}description = "{{$rule.Description}}"
|
|
||||||
id = "{{$rule.RuleID}}"
|
id = "{{$rule.RuleID}}"
|
||||||
|
description = "{{$rule.Description}}"
|
||||||
regex = '''{{$rule.Regex}}'''
|
regex = '''{{$rule.Regex}}'''
|
||||||
secretGroup = {{ $rule.SecretGroup }}
|
{{- with $rule.Path }}
|
||||||
entropy = {{ $rule.Entropy}}
|
path = '''{{ . }}'''{{ end -}}
|
||||||
|
{{- with $rule.SecretGroup }}
|
||||||
|
secretGroup = {{ . }}{{ end -}}
|
||||||
|
{{- with $rule.Entropy }}
|
||||||
|
entropy = {{ . }}{{ end -}}
|
||||||
|
{{- with $rule.Keywords }}
|
||||||
keywords = [
|
keywords = [
|
||||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
{{ range $j, $keyword := . }}"{{ $keyword }}",{{ end }}
|
||||||
]
|
]{{ end }}
|
||||||
|
{{- with $rule.Tags }}
|
||||||
|
tags = [
|
||||||
|
{{ range $j, $tag := . }}"{{ $tag }}",{{ end }}
|
||||||
|
]{{ end }}
|
||||||
|
{{ if or $rule.Allowlist.Regexes $rule.Allowlist.Paths $rule.Allowlist.Commits $rule.Allowlist.StopWords }}
|
||||||
[rules.allowlist]
|
[rules.allowlist]
|
||||||
stopwords= [{{ range $j, $stopword := $rule.Allowlist.StopWords }}
|
{{ with $rule.Allowlist.RegexTarget }}
|
||||||
"{{$stopword}}",{{end}}
|
regexTarget = "{{ . }}"{{ end -}}
|
||||||
]
|
{{- with $rule.Allowlist.Regexes }}
|
||||||
{{ else if and $rule.SecretGroup $rule.Entropy }}description = "{{$rule.Description}}"
|
regexes = [
|
||||||
id = "{{$rule.RuleID}}"
|
{{ range $j, $regex := . }}"{{ $regex }}",{{ end }}
|
||||||
regex = '''{{$rule.Regex}}'''
|
]{{ end }}
|
||||||
secretGroup = {{ $rule.SecretGroup }}
|
{{- with $rule.Allowlist.Paths }}paths = [
|
||||||
entropy = {{ $rule.Entropy}}
|
{{ range $j, $path := . }}"{{ $path }}",{{ end }}
|
||||||
keywords = [
|
]{{ end }}
|
||||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
{{- with $rule.Allowlist.Commits }}commits = [
|
||||||
]
|
{{ range $j, $commit := . }}"{{ $commit }}",{{ end }}
|
||||||
|
]{{ end }}
|
||||||
{{ else if $rule.SecretGroup }}description = "{{$rule.Description}}"
|
{{- with $rule.Allowlist.StopWords }}stopwords = [{{ range $j, $stopword := . }}
|
||||||
id = "{{$rule.RuleID}}"
|
"{{ $stopword }}",{{ end }}
|
||||||
regex = '''{{$rule.Regex}}'''
|
]{{ end }}
|
||||||
secretGroup = {{ $rule.SecretGroup }}
|
{{ end }}
|
||||||
keywords = [
|
{{ end }}
|
||||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
|
||||||
]
|
|
||||||
|
|
||||||
{{ else }}description = "{{$rule.Description}}"
|
|
||||||
id = "{{$rule.RuleID}}"
|
|
||||||
regex = '''{{$rule.Regex}}'''
|
|
||||||
keywords = [
|
|
||||||
{{ range $j, $keyword := $rule.Keywords }}"{{$keyword}}",{{end}}
|
|
||||||
]
|
|
||||||
|
|
||||||
{{end}}{{end}}
|
|
||||||
+163
-161
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user