From 4fa85b958ebabda9bb2312fb988f4c5826388fb5 Mon Sep 17 00:00:00 2001 From: knqyf263 Date: Thu, 10 Oct 2024 15:10:11 +0400 Subject: [PATCH] use template --- .github/workflows/trivy.yaml | 7 +- html.tpl | 148 +++++++++++++++++++++++++++++++++++ 2 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 html.tpl diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index d8f21b1..ab3876e 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -9,9 +9,8 @@ jobs: steps: - uses: actions/checkout@v4 #- uses: knqyf263/trivy-action@1a12292eac50a1a4bec4e98f32c43564e51cff1f - - uses: aquasecurity/trivy-action@807896715e16054f9ae275ea68a15ee3908f0124 + - uses: aquasecurity/trivy-action@0.25.0 with: scan-type: 'image' - scan-ref: 'jenkins:2.60.3' - env: - TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2 + image-ref: 'jenkins:2.60.3' + template: '@/github/workspace/.github/workflows/html.tpl' diff --git a/html.tpl b/html.tpl new file mode 100644 index 0000000..e92b1b1 --- /dev/null +++ b/html.tpl @@ -0,0 +1,148 @@ + + + + +{{- if . }} + + {{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }} + + + +

{{- escapeXML ( index . 0 ).Target }} - Trivy Report - {{ now }}

+ + {{- range . }} + + {{- if (eq (len .Vulnerabilities) 0) }} + + {{- else }} + + + + + + + + + {{- range .Vulnerabilities }} + + + + + + + + + {{- end }} + {{- end }} + {{- if (eq (len .Misconfigurations ) 0) }} + + {{- else }} + + + + + + + + {{- range .Misconfigurations }} + + + + + + + + {{- end }} + {{- end }} + {{- end }} +
{{ .Type | toString | escapeXML }}
No Vulnerabilities found
PackageVulnerability IDSeverityInstalled VersionFixed VersionLinks
{{ escapeXML .PkgName }}{{ escapeXML .VulnerabilityID }}{{ escapeXML .Vulnerability.Severity }}{{ escapeXML .InstalledVersion }}{{ escapeXML .FixedVersion }}
No Misconfigurations found
TypeMisconf IDCheckSeverityMessage
{{ escapeXML .Type }}{{ escapeXML .ID }}{{ escapeXML .Title }}{{ escapeXML .Severity }}
+{{- else }} + + +

Trivy Returned Empty Report

+{{- end }} + +