-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
27 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
name: 'Generate Vulnerabilities Report' | ||
description: 'Generate Vulnerabilities Report' | ||
name: "Generate Vulnerabilities Report" | ||
description: "Generate Vulnerabilities Report" | ||
inputs: | ||
COMPONENT: | ||
description: 'Component to generate the Anchore Report for' | ||
description: "Component to generate the Anchore Report for" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Download json report from build jobs | ||
uses: actions/[email protected] | ||
with: | ||
name: vulnerabilities-${{ inputs.COMPONENT }} | ||
|
||
- name: Download json report from build jobs | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: vulnerabilities-${{ inputs.COMPONENT }} | ||
- name: Generate CSV and intermediate HTML report | ||
shell: bash | ||
run: | | ||
echo "SEVERITY;ID;PACKAGE;VERSION;LINK" > vulnerabilities.csv | ||
cat vulnerabilities.json | jq -r '.matches[] | "\(.vulnerability.severity);\(.vulnerability.id);\(.artifact.name);\(.artifact.version);\(.vulnerability.links[0])"' >> vulnerabilities.csv | ||
echo -e '<table>\n<thead>\n<tr class="header">\n<th><p>SEVERITY</p></th>\n<th><p>ID</p></th>\n<th><p>PACKAGE</p></th>\n<th><p>VERSION</p></th>\n</tr>\n</thead>\n<tbody>' > vulnerabilities.html | ||
cat vulnerabilities.json | jq -r '.matches[] | "<tr>;<td><p>\(.vulnerability.severity)</p></td>;<td><p><a href=\"\(.vulnerability.links[0])\">\(.vulnerability.id)</a></p></td>;<td><p>\(.artifact.name)</p></td>;<td><p>\(.artifact.version)</p></td>;</tr>"' | tr -s ';' '\n' | sed 's!><p>Negligible! style="background-color:#FFFFFF;"><p>Negligible!g' | sed 's!><p>Low! style="background-color:#FFFC9E;"><p>Low!g' | sed 's!><p>Medium! style="background-color:#FE996B;"><p>Medium!g' | sed 's!><p>High! style="background-color:#FD6864;"><p>High!g' | sed 's!><p>Critical! style="background-color:#FE0000;"><p>Critical!g' >> vulnerabilities.html | ||
echo -e '</tbody>\n</table>' >> vulnerabilities.html | ||
- name: Generate CSV and intermediate HTML report | ||
shell: bash | ||
run: | | ||
echo "SEVERITY;ID;PACKAGE;VERSION;LINK" > vulnerabilities.csv | ||
cat vulnerabilities.json | jq -r '.matches[] | "\(.vulnerability.severity);\(.vulnerability.id);\(.artifact.name);\(.artifact.version);\(.vulnerability.links[0])"' >> vulnerabilities.csv | ||
echo -e '<table>\n<thead>\n<tr class="header">\n<th><p>SEVERITY</p></th>\n<th><p>ID</p></th>\n<th><p>PACKAGE</p></th>\n<th><p>VERSION</p></th>\n</tr>\n</thead>\n<tbody>' > vulnerabilities.html | ||
cat vulnerabilities.json | jq -r '.matches[] | "<tr>;<td><p>\(.vulnerability.severity)</p></td>;<td><p><a href=\"\(.vulnerability.links[0])\">\(.vulnerability.id)</a></p></td>;<td><p>\(.artifact.name)</p></td>;<td><p>\(.artifact.version)</p></td>;</tr>"' | tr -s ';' '\n' | sed 's!><p>Negligible! style="background-color:#FFFFFF;"><p>Negligible!g' | sed 's!><p>Low! style="background-color:#FFFC9E;"><p>Low!g' | sed 's!><p>Medium! style="background-color:#FE996B;"><p>Medium!g' | sed 's!><p>High! style="background-color:#FD6864;"><p>High!g' | sed 's!><p>Critical! style="background-color:#FE0000;"><p>Critical!g' >> vulnerabilities.html | ||
echo -e '</tbody>\n</table>' >> vulnerabilities.html | ||
- name: Convert HTLM to PDF | ||
uses: docker://ghcr.io/coprs/reference-system:dependencies_wkhtmltopdf | ||
with: | ||
args: vulnerabilities.html vulnerabilities.pdf | ||
- name: Convert HTLM to PDF | ||
uses: docker://ghcr.io/coprs/reference-system:dependencies_wkhtmltopdf | ||
with: | ||
args: vulnerabilities.html vulnerabilities.pdf | ||
|
||
- name: Upload Anchore scan reports | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: vulnerabilities-${{ inputs.COMPONENT }} | ||
path: | | ||
vulnerabilities.csv | ||
vulnerabilities.pdf | ||
- name: Upload Anchore scan reports | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: vulnerabilities-${{ inputs.COMPONENT }} | ||
path: | | ||
vulnerabilities.csv | ||
vulnerabilities.pdf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters