From d572ea1a7bb2cca0c4fa1cb0021e1d7157a25a2a Mon Sep 17 00:00:00 2001 From: kjeld Schouten-Lebbing Date: Sat, 4 Dec 2021 22:59:49 +0100 Subject: [PATCH] feat(ci): Craft a trivy config to md parser --- charts/stable/jackett/Chart.yaml | 2 +- templates/trivy-config.tpl | 21 +++++++++++++++++++++ tools/build-release.sh | 3 +-- 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 templates/trivy-config.tpl diff --git a/charts/stable/jackett/Chart.yaml b/charts/stable/jackett/Chart.yaml index 0fb430fc2fd..0c4b5c3f575 100644 --- a/charts/stable/jackett/Chart.yaml +++ b/charts/stable/jackett/Chart.yaml @@ -21,7 +21,7 @@ name: jackett sources: - https://github.com/Jackett/Jackett type: application -version: 9.0.31 +version: 9.0.32 annotations: truecharts.org/catagories: | - media diff --git a/templates/trivy-config.tpl b/templates/trivy-config.tpl new file mode 100644 index 00000000000..6f4e91d717d --- /dev/null +++ b/templates/trivy-config.tpl @@ -0,0 +1,21 @@ +{{- if . -}} +#### Chart Object: {{ escapeXML ( index . 0 ).Target }} + {{ range . }} + + {{ if (eq (len .Misconfigurations) 0) }} +| No Misconfigurations found | +|:---------------------------------| + + {{ else }} +| Type | Misconfiguration ID | Check | Severity | Explaination | Solution | Links | +|:----------------|:------------------:|:-----------:|:------------------:|:-------------:|-----------------------------------------|-----------------------------------------| + {{- range .Misconfigurations }} +| {{ escapeXML .Type }} | {{ escapeXML .ID }} | {{ escapeXML .Title }} | {{ escapeXML .Severity }} | {{ escapeXML .Description }} | {{ escapeXML .Message }} |
Click to expand!{{ range .References }}{{ escapeXML . }}
{{ end }}
| + {{- end }} + {{- end }} + {{- end }} +{{- else }} + +| No Misconfigurations found | +|:---------------------------------| +{{- end }} diff --git a/tools/build-release.sh b/tools/build-release.sh index eadb49583d0..199a8e00084 100755 --- a/tools/build-release.sh +++ b/tools/build-release.sh @@ -299,7 +299,7 @@ helm_sec_scan() { echo "##### Scan Results" >> ${chart}/security.md echo "" >> ${chart}/security.md helm template ${chart} --output-dir ${chart}/render > /dev/null - trivy config -f template --template "@./templates/trivy.tpl" -o ${chart}/render/tmpsec${chartname}.md ${chart}/render + trivy config -f template --template "@./templates/trivy-config.tpl" -o ${chart}/render/tmpsec${chartname}.md ${chart}/render cat ${chart}/render/tmpsec${chartname}.md >> ${chart}/security.md rm -rf ${chart}/render/tmpsec${chartname}.md || true echo "" >> ${chart}/security.md @@ -323,7 +323,6 @@ container_sec_scan() { echo "" >> ${chart}/security.md for container in $(cat ${chart}/render/containers.tmp); do echo "processing container: ${container}" - echo "**Container: ${container}**" >> ${chart}/security.md echo "" >> ${chart}/security.md trivy image -f template --template "@./templates/trivy-container.tpl" -o ${chart}/render/tmpsec${chartname}.md "${container}" cat ${chart}/render/tmpsec${chartname}.md >> ${chart}/security.md