{% if grype_data %} {% set matches = grype_data.get('matches', []) %}

Grype — SCA Findings

{% if matches %} {# --- quick stats --- #} {% set sev_counts = {'critical':0,'high':0,'medium':0,'low':0,'negligible':0,'unknown':0} %} {% for m in matches %} {% set vuln = m.vulnerability if m.vulnerability is defined else {} %} {% set sev = (vuln.severity | default('unknown')) | lower %} {% if sev in sev_counts %}{% set _ = sev_counts.__setitem__(sev, sev_counts[sev] + 1) %}{% else %}{% set _ = sev_counts.__setitem__('unknown', sev_counts['unknown'] + 1) %}{% endif %} {% endfor %}
Total: {{ matches|length }} Critical: {{ sev_counts.critical }} High: {{ sev_counts.high }} Medium: {{ sev_counts.medium }} Low: {{ sev_counts.low }} Negligible: {{ sev_counts.negligible }} Unknown: {{ sev_counts.unknown }}
{% endif %}
{% if matches %}
{% for m in matches %} {# Handle artifact/package differences defensively #} {% set art = m.artifact if m.artifact is defined else m.get('package', {}) %} {% set vuln = m.vulnerability if m.vulnerability is defined else {} %} {% set loc = (art.locations[0] if art.locations is defined and art.locations else {}) %} {% set loc_path = loc.realPath if loc.realPath is defined else (loc.path if loc.path is defined else '') %} {# Fix versions (array) or state #} {% set fix = vuln.fix if vuln.fix is defined else {} %} {% set fix_versions = fix.versions if fix.versions is defined else [] %} {% set fix_state = fix.state if fix.state is defined else '' %} {% set sev_raw = vuln.severity | default('Unknown') %} {% set sev = sev_raw | lower %} {% set sev_chip = 'chip--bad' if sev in ['critical','high'] else ('chip--neutral' if sev == 'medium' else ('chip--ok' if sev in ['low','negligible'] else '')) %} {# Additional details for expansion #} {% set description = vuln.description if vuln.description is defined else '' %} {% set cvss = vuln.cvss if vuln.cvss is defined else [] %} {% set epss = vuln.epss if vuln.epss is defined else [] %} {% set cwes = vuln.cwes if vuln.cwes is defined else [] %} {% set related_vulns = m.relatedVulnerabilities if m.relatedVulnerabilities is defined else [] %} {% set match_details = m.matchDetails if m.matchDetails is defined else [] %} {% set purl = art.purl if art.purl is defined else '' %} {% set cpes = art.cpes if art.cpes is defined else [] %} {% set licenses = art.licenses if art.licenses is defined else [] %} {% set namespace = vuln.namespace if vuln.namespace is defined else '' %} {% set risk = vuln.risk if vuln.risk is defined else '' %} {% set fingerprints = m.fingerprints if m.fingerprints is defined else {} %} {% set fingerprint_list = [] %} {% if fingerprints.pkg %}{% set _ = fingerprint_list.append(('pkg', fingerprints.pkg)) %}{% endif %} {% if fingerprints.ctx %}{% set _ = fingerprint_list.append(('ctx', fingerprints.ctx)) %}{% endif %} {% if fingerprints.exact %}{% set _ = fingerprint_list.append(('exact', fingerprints.exact)) %}{% endif %} {% set default_fp = '' %} {# Default to ctx fingerprint if available, otherwise first available #} {% if fingerprints.ctx %} {% set default_fp = fingerprints.ctx %} {% elif fingerprints.ctx_soft %} {% set default_fp = fingerprints.ctx_soft %} {% elif fingerprint_list|length > 0 %} {% set default_fp = fingerprint_list[0][1] %} {% endif %} 0 %}data-fingerprints='{{ fingerprint_list|map(attribute=1)|list|tojson }}'{% endif %}> {% endfor %}
Package Version Type Location Vulnerability Severity Fix Waiver
{{ art.name | default('') | e }} {{ art.version | default('') | e }} {{ art.type | default('') | e }} {{ loc_path | e }} {% if ref_url %} {{ vuln.id | default('') | e }} {% else %} {{ vuln.id | default('') | e }} {% endif %} {{ sev_raw | e }} {% if fix_versions and fix_versions|length > 0 %} {{ fix_versions | join(', ') | e }} {% elif fix_state %} {{ fix_state | capitalize | e }} {% else %} — {% endif %} {% if fingerprint_list|length > 0 %}
{% else %} — {% endif %}
{% if description %}

Description

{{ description | e }}

{% endif %}

Vulnerability Details

{% if vuln.id %}
Vulnerability ID:
{{ vuln.id | e }}
{% endif %} {% if namespace %}
Namespace:
{{ namespace | e }}
{% endif %} {% if sev_raw %}
Severity:
{{ sev_raw | e }}
{% endif %} {% if risk %}
Risk Score:
{{ "%.2f"|format(risk) }}
{% endif %} {% if ref_url %}
Data Source:
{{ ref_url | e }}
{% endif %}
{% if cvss %}

CVSS Scores

{% for c in cvss %} {% if c.version %}
CVSS {{ c.version }}:
{% if c.metrics and c.metrics.baseScore is defined %} {{ c.metrics.baseScore }} {% endif %} {% if c.vector %} {{ c.vector | e }} {% endif %}
{% endif %} {% endfor %}
{% endif %} {% if epss %}

EPSS Scores

{% for e in epss %} {% if e.epss is defined %}
EPSS Score:
{{ "%.4f"|format(e.epss) }} {% if e.percentile is defined %} Percentile: {{ "%.5f"|format(e.percentile) }} {% endif %}
{% endif %} {% endfor %}
{% endif %} {% if cwes %}

CWE

CWE IDs:
{% for cwe_item in cwes %} {% if cwe_item.cwe is defined %} CWE-{{ cwe_item.cwe }} {% endif %} {% endfor %}
{% endif %}

Package Details

{% if art.name %}
Package:
{{ art.name | e }}
{% endif %} {% if art.version %}
Version:
{{ art.version | e }}
{% endif %} {% if art.type %}
Type:
{{ art.type | e }}
{% endif %} {% if purl %}
PURL:
{{ purl | e }}
{% endif %} {% if loc_path %}
Location:
{{ loc_path | e }}
{% endif %} {% if licenses %}
Licenses:
{% for lic in licenses %} {% if lic.value is defined %} {{ lic.value | e }} {% endif %} {% endfor %}
{% endif %}
{% if fix_versions or fix_state %}

Fix Information

{% if fix_versions and fix_versions|length > 0 %}
Fixed Versions:
{% for fv in fix_versions %} {{ fv | e }} {% endfor %}
{% elif fix_state %}
Fix State:
{{ fix_state | capitalize | e }}
{% endif %}
{% endif %} {% if related_vulns %}

Related Vulnerabilities

Related:
    {% for rv in related_vulns %} {% if rv.id is defined %}
  • {{ rv.id | e }} {% if rv.description %} {{ rv.description[:100] | e }}{% if rv.description|length > 100 %}...{% endif %} {% endif %}
  • {% endif %} {% endfor %}
{% endif %} {% if fingerprints %}

Fingerprints

{% if fingerprints.pkg %}
Package Fingerprint:
{{ fingerprints.pkg | e }}
{% endif %} {% if fingerprints.exact %}
Exact Fingerprint:
{{ fingerprints.exact | e }}
{% endif %} {% if fingerprints.ctx %}
Context Fingerprint:
{{ fingerprints.ctx | e }}
{% endif %}

Fingerprint Types:
PKG: Package-level identifier derived from vulnerability ID and package coordinate. Stable across environments and locations.
EXACT: Location-bound identifier derived from vulnerability ID, source hint, location hash, and package version. Binds tightly to a specific environment.
CTX: Contextual identifier derived from vulnerability ID, package hash, and context hash. Remains valid through small changes.

{% endif %}
{% else %}
No SCA findings.
{% endif %}
{% endif %}