pcfens / sast-parser

Parse GitLab SAST reports into more human readable projects
Apache License 2.0
54 stars 19 forks source link

Add Markdown and Plain-Text outputs / templates / options #8

Open khalilgharbaoui opened 1 year ago

khalilgharbaoui commented 1 year ago

Would be great if one could have a flag/option to output Markdown or Plain Text example:

sast-parser --html gl-sast-report.json (default)
sast-parser --markdown gl-sast-report.json
sast-parser --text gl-sast-report.json

Micke90s commented 4 months ago

@khalilgharbaoui I play around with a fork of the project as I need a few changes. How should the markdown look? A table view is complex as the line breaks destroy the markdown table. I tested the following solution:

{% for vuln in vulnerabilities|sort(attribute='severity') -%}
# {{loop.index}} -  {{vuln.severity}} - {{vuln.location.file}} 
{% if vuln.message -%}
## Message 
{{vuln.description}}
{% endif -%}
{% if vuln.description -%}
## Description
{{vuln.description}}
{% endif -%}
## Location
{{vuln.location.file}}{% if vuln.location.start_line %}:{{vuln.location.start_line}}{% if vuln.location.end_line and vuln.location.start_line < vuln.location.end_line %} - {{vuln.location.end_line}}{% endif %}{% endif %}
{% endfor -%}

Also, I am not sure about the plain text. How this should be structured? I don`t think that plain text would be useful.