{
  "version": "2.1.0",
  "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0.json",
  "runs": [
    {
      "tool": {
        "driver": {
          "name": "OWASP Dependency-Track",
          "fullName": "OWASP Dependency-Track - {{ dependencyTrackVersion }}",
          "version": "{{ dependencyTrackVersion }}",
          "informationUri": "https://dependencytrack.org/",
          "rules": [{% for vuln in uniqueVulnerabilities %}
            {
              "id": "{{ vuln.vulnId }}",
              "name": "{{ vuln.cweName }}",
              "shortDescription": {
                "text": "{{ vuln.vulnId }}"
              },
              "fullDescription": {
                "text": "{{ vuln.description | trim }}"
              }
            }{% if not loop.last %},{% endif %}{% endfor %}
          ]
        }
      },
      "results": [{% for finding in findings %}
        {
          "ruleId": "{{ finding.vulnerability.vulnId }}",
          "message": {
            "text": "{{ finding.vulnerability.description | trim }}"
          },
          "locations": [
            {
              "logicalLocations": [
                {
                  "fullyQualifiedName": "{{ finding.component.purl }}"
                }
              ]
            }
          ],
          "level": {% if ['LOW', 'INFO'] contains finding.vulnerability.severity %}"note",{% elseif finding.vulnerability.severity == 'MEDIUM' %}"warning",{% elseif ['HIGH', 'CRITICAL'] contains finding.vulnerability.severity %}"error",{% else %}"none",{% endif %}
          "properties": {
            "name": "{{ finding.component.name }}",
            "group": "{{ finding.component.group }}",
            "version": "{{ finding.component.version }}",
            "source": "{{ finding.vulnerability.source }}",
            "cweId": "{{ finding.vulnerability.cweId }}",
            "cvssV3BaseScore": "{{ finding.vulnerability.cvssV3BaseScore }}",
            "epssScore": "{{ finding.vulnerability.epssScore }}",
            "epssPercentile": "{{ finding.vulnerability.epssPercentile }}",
            "severityRank": "{{ finding.vulnerability.severityRank }}",
            "recommendation": "{{ finding.vulnerability.recommendation | trim }}"
          }
        }{% if not loop.last %},{% endif %}{% endfor %}
      ]
    }
  ]
}
