-
Notifications
You must be signed in to change notification settings - Fork 0
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
6 changed files
with
731 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM python:3.9.5 | ||
|
||
ENV REPORT_FILE="/github/workspace/report.json" | ||
ENV MARKDOWN_FILE="/github/workspace/report.md" | ||
ENV MUSTACHE_TEMPLATE="./report.md.mustache" | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
CMD ["/usr/src/app/clair-to-markdown.py"] | ||
|
||
ENTRYPOINT ["python3"] |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: 'Clair to markdown' | ||
description: 'Translate clair-json-reports to markdown.' | ||
author: [email protected] | ||
branding: | ||
icon: 'tag' | ||
color: 'green' | ||
inputs: | ||
reportFile: | ||
description: Path to the clair-json-report inside the contaienr. | ||
required: false | ||
default: "/github/workspace/report.json" | ||
markdownFile: | ||
description: Path to the generated markdown inside the contaienr. | ||
required: false | ||
default: "/github/workspace/report.md" | ||
mustacheTemplate: | ||
description: Path to an alternative mustache template for generating reports | ||
required: false | ||
default: "./report.md.mustache" | ||
runs: | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
env: | ||
REPORT_FILE: ${{ inputs.reportFile }} | ||
MARKDOWN_FILE: ${{ inputs.markdownFile }} | ||
MUSTACHE_TEMPLATE: ${{ inputs.mustacheTemplate }} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
import os | ||
import json | ||
import pystache | ||
|
||
report_file = os.getenv("REPORT_FILE") | ||
markdown_file = os.getenv("MARKDOWN_FILE") | ||
mustache_file = os.getenv("MUSTACHE_TEMPLATE") | ||
|
||
json_file=open(report_file) | ||
json_report = json.load(json_file) | ||
|
||
mustache_template=open(mustache_file) | ||
template_string= mustache_template.read() | ||
|
||
|
||
rendered_report=pystache.render(template_string, json_report) | ||
with open(markdown_file, "w") as markdown_report: | ||
markdown_report.write(rendered_report) |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# {{image}} | ||
|
||
## Vulnerabilities | ||
|
||
| Severity | Featurename | Version | CVE | Namespace | Description | Link | Fixed by | | ||
|----------|-------------|---------|-----|-----------|-------------|------|----------| | ||
{{#vulnerabilities}} | ||
|{{severity}}|{{featurename}}|{{featureversion}}|{{vulnerability}}|{{namespace}}|{{description}}|{{link}}|{{fixedby}}| | ||
{{/vulnerabilities}} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
pystache |