/
githubmirror
/
trivy
Обзор
Документация
Войти
/
githubmirror
/
trivy
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
contrib/gitlab-codequality.tpl
103 строки
3 KB
Nate
feat(report): add secrets template for codequality report (#2461)
27 июл 2022, 10:55
Не верифицирован
27 июл 2022, 10:55
946ce16
Код
Авторство
О чём код?
{{- /* Template based on https://github.com/codeclimate/platform/blob/master/spec/analyzers/SPEC.md#data-types */ -}} [ {{- $t_first := true }} {{- range . }} {{- $target := .Target }} {{- range .Vulnerabilities -}} {{- if $t_first -}} {{- $t_first = false -}} {{ else -}} , {{- end }} { "type": "issue", "check_name": "container_scanning", "categories": [ "Security" ], "description": {{ list .VulnerabilityID .PkgName .InstalledVersion .Title | join " - " | printf "%q" }}, "fingerprint": "{{ list .VulnerabilityID .PkgName .InstalledVersion $target | join "" | sha1sum }}", "content": {{ .Description | printf "%q" }}, "severity": {{ if eq .Severity "LOW" -}} "info" {{- else if eq .Severity "MEDIUM" -}} "minor" {{- else if eq .Severity "HIGH" -}} "major" {{- else if eq .Severity "CRITICAL" -}} "critical" {{- else -}} "info" {{- end }}, "location": { "path": "{{ $target }}", "lines": { "begin": 0 } } } {{- end -}} {{- range .Misconfigurations -}} {{- if $t_first -}} {{- $t_first = false -}} {{ else -}} , {{- end }} { "type": "issue", "check_name": "container_scanning", "categories": [ "Security" ], "description": {{ list "Misconfig" .ID .Title | join " - " | printf "%q" }}, "fingerprint": "{{ list .ID .Title $target | join "" | sha1sum }}", "content": {{ .Description | printf "%q" }}, "severity": {{ if eq .Severity "LOW" -}} "info" {{- else if eq .Severity "MEDIUM" -}} "minor" {{- else if eq .Severity "HIGH" -}} "major" {{- else if eq .Severity "CRITICAL" -}} "critical" {{- else -}} "info" {{- end }}, "location": { "path": "{{ $target }}", "lines": { "begin": {{ .CauseMetadata.StartLine }} } } } {{- end -}} {{- range .Secrets -}} {{- if $t_first -}} {{- $t_first = false -}} {{ else -}} , {{- end }} { "type": "issue", "check_name": "container_scanning", "categories": [ "Security" ], "description": {{ list "Secret" .RuleID .Title | join " - " | printf "%q" }}, "fingerprint": "{{ list .RuleID .Title $target | join "" | sha1sum }}", "content": {{ .Title | printf "%q" }}, "severity": {{ if eq .Severity "LOW" -}} "info" {{- else if eq .Severity "MEDIUM" -}} "minor" {{- else if eq .Severity "HIGH" -}} "major" {{- else if eq .Severity "CRITICAL" -}} "critical" {{- else -}} "info" {{- end }}, "location": { "path": "{{ $target }}", "lines": { "begin": {{ .StartLine }} } } } {{- end -}} {{- end }} ]