{# Exploitability Evidence family — shared kind-aware verdict card macro. The single source of card structure for BOTH the console (internal) and briefing (external) templates. Both do: {% import "_exploitability_macros.html" as exp with context %} {% for card in cards %}{{ exp.verdict_card(card, mode) }}{% endfor %} so the card is byte-identical across modes — only the redaction-guarded blocks differ. The transform already STRIPPED external secrets (inline_excerpt / cost_actuals / raw_confidence / tier_provenance); this macro only needs `{% if c.inline_excerpt %}` / `{% if mode == 'internal' %}` guards so it never reaches around the transform's redaction. Display labels are owned HERE (the transform deliberately emits no label strings — a transform test asserts their absence). The map is keyed on verdict.kind (the contract enum), NOT the platform_status. Spec: docs/superpowers/specs/2026-06-20-exploitability-report-design.md §3.2 (element order + conditional sections), §3.3 (audience modes), §6. #} {# kind -> customer-facing badge label (spec §3.2). #} {% set kind_labels = { "AFFECTED": "EXPLOITABLE", "NOT_AFFECTED": "NOT AFFECTED", "INCONCLUSIVE": "INCONCLUSIVE (IN TRIAGE)", "UNDER_INVESTIGATION": "UNDER INVESTIGATION (IN TRIAGE)", "VERIFIER_FAILED": "VERIFIER ERRORED", } %} {# ------------------------------------------------------------------ chip_row(enrichment) — header chips: CVSS · EPSS · KEV/VcKEV · severity. ------------------------------------------------------------------ #} {% macro chip_row(enrichment) -%} {% set e = enrichment or {} %} {# Use .get() so a sparse enrichment (thin dataset: keys absent) yields None, not Jinja Undefined — `Undefined is not none` is TRUE and would reach |float and crash. Severity CSS classes are uppercase (.exp-sev-CRITICAL), so the class is |upper'd while the chip text shows the raw value. #}
{% if e.get('cvss') is not none %}CVSS {{ "%.1f"|format(e.get('cvss')|float) }}{% endif %} {% if e.get('epss') is not none %}EPSS {{ "%.0f"|format(e.get('epss')|float * 100) }}%{% endif %} {% if e.get('kev') %}CISA KEV{% endif %} {% if e.get('vckev') %}VulnCheck KEV{% endif %} {% if e.get('exploit_maturity') and e.get('exploit_maturity') != 'none' %}{{ e.get('exploit_maturity') }}{% endif %} {% if e.get('severity') %}{{ e.get('severity') }}{% endif %}
{%- endmacro %} {# ------------------------------------------------------------------ confidence_bar(confidence) — pure-CSS fill, width from the calibrated confidence (0..1). No JS. Null confidence -> a muted "not calibrated". ------------------------------------------------------------------ #} {% macro confidence_bar(confidence) -%}
Confidence {# `is defined` guards a sparse card where the key is absent (Jinja Undefined would slip past `is not none` and crash at |float). #} {% if confidence is defined and confidence is not none %} {{ (confidence|float * 100)|round(0)|int }}% {% else %} not calibrated {% endif %}
{%- endmacro %} {# ------------------------------------------------------------------ locus_block(locus, kind) — Where to investigate. Renders ONLY when the locus has real content; NEVER fabricated. For NOT_AFFECTED, renders the why-not variant only when a locus is present. ------------------------------------------------------------------ #} {% macro locus_block(locus, kind) -%} {% set l = locus or {} %} {% set has_locus = l and (l.vulnerable_functions or l.source_refs or l.call_path or l.binary_offsets) %} {% if has_locus %}
{% if kind == 'NOT_AFFECTED' %}Why not reachable{% else %}Where to investigate{% endif %}
{% if l.vulnerable_functions %}
Vulnerable functions{{ l.vulnerable_functions | join(', ') }}
{% endif %} {% if l.source_refs %}
Source{% for ref in l.source_refs %}{{ ref.file }}:{{ ref.line }}{% if not loop.last %}, {% endif %}{% endfor %}
{% endif %} {% if l.call_path %}
Call path{{ l.call_path | join(' → ') }}
{% endif %} {% if l.binary_offsets %}
Binary offsets{{ l.binary_offsets | join(', ') }}
{% endif %}
{% endif %} {%- endmacro %} {# ------------------------------------------------------------------ verdict_card(card, mode) — the kind-aware proof-sheet card. Element order (spec §3.2): header -> verdict strip -> Proposed VEX -> kind body -> Where to investigate -> Remediation (conditional) -> Evidence -> Replay. Each block renders ONLY under its "Shown when" rule. ------------------------------------------------------------------ #} {% macro verdict_card(card, mode) -%} {% set t = card.target or {} %} {% set v = card.verdict or {} %} {% set kind = v.kind %} {% set e = card.enrichment or {} %} {% set pv = card.proposed_vex %} {% set rem = card.remediation %} {% set prov = card.provenance or {} %}
{# 1. Header — target, cwe/alias, chips. [all] #}
{{ t.cve_id }} {% if t.component_name %}· {{ t.component_name }}{% endif %} {% if t.version_name %}· {{ t.version_name }}{% endif %}
{% if t.cwe or t.cve_alias %}
{% if t.cwe %}{{ t.cwe }}{% endif %}{% if t.cwe and t.cve_alias %} · {% endif %}{% if t.cve_alias %}{{ t.cve_alias }}{% endif %}
{% endif %} {{ chip_row(e) }}
{# 2. Verdict strip — kind-tinted badge (label per the map) + confidence. [all] #}
{{ kind_labels.get(kind, kind) }} {{ confidence_bar(card.confidence) }}
{# meta rail — Proposed VEX + kind body + locus + remediation. #}
{# 3. Proposed VEX — platform vocabulary verbatim. [all except VERIFIER_FAILED] #}
Proposed VEX
{% if kind == 'VERIFIER_FAILED' or not pv %}

none — re-run the verifier to produce a VEX.

{% else %}
{{ pv.status }}{% if pv.response %} · {{ pv.response }}{% endif %}{% if pv.justification %} · {{ pv.justification }}{% endif %}
{% if pv.statement %}

{{ pv.statement }}

{% endif %} {% if pv.evidence_citation_ids %}
Backed by: {{ pv.evidence_citation_ids | join(', ') }}
{% endif %}
{% endif %}
{# 4. Kind body — per-kind fields from verdict. [by kind] #}
Verdict detail
{% if kind == 'AFFECTED' %} {% if v.platform_response %}
Response{{ v.platform_response }}
{% endif %} {% if v.conditional %}
Conditional{% if v.conditional_gates %}{{ v.conditional_gates | join(', ') }}{% else %}yes{% endif %}
{% endif %} {% if v.reason_summary %}

{{ v.reason_summary }}

{% endif %} {% elif kind == 'NOT_AFFECTED' %} {% if v.platform_justification %}
Justification{{ v.platform_justification }}
{% endif %} {% if v.reason_summary %}

{{ v.reason_summary }}

{% endif %} {% elif kind == 'INCONCLUSIVE' %} {% if v.reason_summary %}

{{ v.reason_summary }}

{% endif %} {% if v.what_would_resolve_it %}
What would resolve it{{ v.what_would_resolve_it }}
{% endif %} {% elif kind == 'UNDER_INVESTIGATION' %} {% if v.reason_summary %}

{{ v.reason_summary }}

{% endif %} {% if v.blocked_by %}
Blocked by{{ v.blocked_by }}
{% endif %} {% if v.resume_descriptor %}
Resume{{ v.resume_descriptor }}
{% endif %} {% if v.capability_request %}
Capability request{{ v.capability_request }}
{% endif %} {% elif kind == 'VERIFIER_FAILED' %} {% if v.failure_class %}
Failure class{{ v.failure_class }}
{% endif %} {% if v.details %}

{{ v.details }}

{% endif %} {% else %} {% if v.reason_summary %}

{{ v.reason_summary }}

{% endif %} {% endif %}
{# 5. Where to investigate — only when locus present (never fabricated). #} {# [AFFECTED/INCONCLUSIVE/UNDER_INVESTIGATION; NOT_AFFECTED why-not when locus present] #} {{ locus_block(card.locus, kind) }} {# 6. Remediation — ONLY when remediation present/non-null. #} {% if rem %}
Remediation
{% if rem.action %}
Action{{ rem.action }}
{% endif %} {% if rem.fix_version %}
Fix version{{ rem.fix_version }}
{% endif %} {% if rem.workaround %}
Workaround{{ rem.workaround }}
{% endif %}
{% endif %}
{# evidence-forward column — primary evidence + progressive disclosure. #}
{# 7. Evidence — tiered. Primary citation ALSO shows inline_excerpt (internal only; external already redacted -> guard). [all] #}
Evidence
{% set citations = card.citations or [] %} {% set primary = citations | selectattr('role', 'equalto', 'primary') | list %} {% set supporting = citations | selectattr('role', 'equalto', 'supporting') | list %} {% if not citations %}

No citations on this record.

{% endif %} {% for c in primary %}
{{ c.claim }}
{{ c.evidence_type }} · {{ c.checksum }}
{% if c.inline_excerpt %}
{{ c.inline_excerpt }}
{% endif %}
{% endfor %} {# Progressive disclosure: supporting citations + (internal only) tier_provenance behind a no-JS
expander. #} {% set show_tier = (mode == 'internal') and prov.tier_provenance %} {% if supporting or show_tier %}
Supporting evidence{% if show_tier %} & tier provenance{% endif %} {% for c in supporting %}
{{ c.claim }}
{{ c.evidence_type }} · {{ c.checksum }}
{% endfor %} {% if show_tier %}
Tier provenance
{% set tp = prov.tier_provenance %} {% if tp.tiers_run %}
Tiers run{{ tp.tiers_run | join(', ') }}
{% endif %} {% if tp.new_templates_authored is not none %}
New templates authored{{ tp.new_templates_authored }}
{% endif %}
{% endif %}
{% endif %} {# Internal-only verifier telemetry (cost actuals) behind disclosure. #} {% if mode == 'internal' and card.cost_actuals %} {% set ca = card.cost_actuals %}
Verifier cost (internal)
{% if ca.tokens is not none %}
Tokens{{ ca.tokens }}
{% endif %} {% if ca.wall_clock_s is not none %}
Wall clock (s){{ ca.wall_clock_s }}
{% endif %} {% if ca.qemu_s is not none %}
QEMU (s){{ ca.qemu_s }}
{% endif %} {% if ca.forge_calls is not none %}
Forge calls{{ ca.forge_calls }}
{% endif %} {% if ca.llm_calls_by_subagent %}
LLM calls by subagent{% for k, n in ca.llm_calls_by_subagent.items() %}{{ k }}={{ n }}{% if not loop.last %}, {% endif %}{% endfor %}
{% endif %}
{% endif %} {# raw_confidence (internal only) shown beside the calibrated value. #} {% if mode == 'internal' and card.raw_confidence is not none %}
Raw (uncalibrated) confidence: {{ (card.raw_confidence|float * 100)|round(0)|int }}%
{% endif %}
{# 8. Replay — provenance chain. [all] #}
Replay: {{ prov.bundle_id }} {% if prov.replay_seed %} · seed {{ prov.replay_seed }}{% endif %} {% if prov.replay_trace_id %} · trace {{ prov.replay_trace_id }}{% endif %} {% if prov.catalog_version %} · catalog {{ prov.catalog_version }}{% endif %} {% if prov.agent_version %} · agent {{ prov.agent_version }}{% endif %} {% if prov.sealed_at %} · sealed {{ prov.sealed_at }}{% endif %} {% if prov.bundle_id %}
Reproduce: replay_pen_test {{ prov.bundle_id }}{% endif %}
{%- endmacro %} {# ================================================================== v2 macros (exploitability-dataset/v2, spec 2026-06-23 §4/§8). The v1 macros above are retained for the legacy {cover,coverage,cards} render path until the §10 cutover; the v2 templates dispatch to these under {% if buckets %}. Cards read v2 fields: verdict.platform_* (VEX, replaces proposed_vex) · evidence.evidence_summary (un-redacted proof, single source) · evidence.{exploit_proof,backport_ref, absence_proof,reachability,locus} · target.component_version · card.internal.* (internal-only telemetry) · card.trust_tier (transform-derived). ================================================================== #} {% set method_labels = { "dynamic_pov": "dynamic PoV", "static": "static analysis", "reachability": "reachability", "version_fact": "version fact", } %} {# trust_pill(tier) — calibrated-confidence tier pill (High/Moderate/Low). #} {% macro trust_pill(tier) -%} {% if tier %}{{ {"high": "High", "moderate": "Moderate", "low": "Low"}.get(tier, tier) }} confidence{% endif %} {%- endmacro %} {# evidence_block_v2(ev) — prose-first proof + optional typed evidence. #} {% macro evidence_block_v2(ev) -%} {% set ev = ev or {} %} {% if ev.evidence_summary %}

{{ ev.evidence_summary }}

{% endif %} {% set xp = ev.exploit_proof %} {% if xp %}
Crash signal{{ xp.signal }}{% if xp.faulting_object %} in {{ xp.faulting_object }}{% endif %}{% if xp.faulting_symbol %} · {{ xp.faulting_symbol }}{% endif %}
{% if xp.trigger_summary %}
Trigger{{ xp.trigger_summary }}
{% endif %} {% endif %} {% set bp = ev.backport_ref %} {% if bp %}
Backport{{ bp.commit }}{% if bp.match_method %} ({{ bp.match_method }}-matched){% endif %}
{% if bp.upstream_fix %}
Upstream fix{{ bp.upstream_fix }}
{% endif %} {% endif %} {% set ap = ev.absence_proof %} {% if ap %}
Absent{{ ap.what }}{% if ap.markers_checked is not none %} — 0/{{ ap.markers_checked }} markers{% endif %}{% if ap.files_scanned is not none %} across {{ ap.files_scanned }} files{% endif %}
{% endif %} {% set rc = ev.reachability %} {% if rc %} {% if rc.fact %}
Reachability{{ rc.fact }}
{% endif %} {% if rc.setuid_count is not none %}
setuid binaries{{ rc.setuid_count }}
{% endif %} {% if rc.importers %}
Importers{{ rc.importers | join('; ') }}
{% endif %} {% endif %} {%- endmacro %} {# locus_block_v2(locus, kind) — Where to investigate; v2 locus arrays are plain strings (source_refs/binary_offsets), not {file,line} objects. #} {% macro locus_block_v2(locus, kind) -%} {% set l = locus or {} %} {% set has_locus = l and (l.vulnerable_functions or l.source_refs or l.call_path or l.binary_offsets) %} {% if has_locus %}
{% if kind == 'NOT_AFFECTED' %}Where it would be{% else %}Where to investigate{% endif %}
{% if l.vulnerable_functions %}
Vulnerable functions{{ l.vulnerable_functions | join(', ') }}
{% endif %} {% if l.source_refs %}
Source{{ l.source_refs | join(', ') }}
{% endif %} {% if l.call_path %}
Call path{{ l.call_path | join(' → ') }}
{% endif %} {% if l.binary_offsets %}
Binary offsets{{ l.binary_offsets | join(', ') }}
{% endif %}
{% endif %} {%- endmacro %} {# verdict_card_v2(card, mode) — the v2 proof-sheet card. #} {% macro verdict_card_v2(card, mode) -%} {% set t = card.target or {} %} {% set v = card.verdict or {} %} {% set kind = v.kind %} {% set ev = card.evidence or {} %} {% set e = card.enrichment or {} %} {% set rem = card.remediation %} {% set prov = card.provenance or {} %}
{# 1. Header — target, cwe/alias, chips. #}
{{ t.cve_id }} {% if t.component_name %}· {{ t.component_name }}{% endif %} {% if t.component_version %}· {{ t.component_version }}{% endif %}
{% if t.cwe or (t.cve_alias and t.cve_alias != t.cve_id) %}
{% if t.cwe %}{{ t.cwe }}{% endif %}{% if t.cwe and t.cve_alias and t.cve_alias != t.cve_id %} · {% endif %}{% if t.cve_alias and t.cve_alias != t.cve_id %}{{ t.cve_alias }}{% endif %}
{% endif %} {% if t.cve_description %}

{{ t.cve_description }}

{% endif %} {{ chip_row(e) }}
{# 2. Verdict strip — badge + method sub-label + trust tier + confidence. #}
{{ kind_labels.get(kind, kind) }} {% if card.method %}{{ method_labels.get(card.method, card.method) }}{% endif %} {{ trust_pill(card.trust_tier) }} {{ confidence_bar(card.confidence) }}
{# 3. Conditional gate (AFFECTED). #} {% if v.conditional and v.conditional_gates %}
Exploitable only if
    {% for g in v.conditional_gates %}
  • {{ g }}
  • {% endfor %}
{% endif %} {# 4. Reconstructed VEX — platform labels only (prose lives in Evidence). #}
VEX
{% if v.platform_status %}
{{ v.platform_status }}{% if v.platform_response %} · {{ v.platform_response }}{% endif %}{% if v.platform_justification %} · {{ v.platform_justification }}{% endif %}
{% else %}

No VEX applied from these results yet.

{% endif %}
{# 5. Where to investigate (locus present only; never fabricated). #} {{ locus_block_v2(ev.locus, kind) }} {# 6. Remediation (present only). #} {% if rem and (rem.action or rem.fix_version or rem.workaround) %}
Remediation
{% if rem.action %}
Action{{ rem.action }}
{% endif %} {% if rem.fix_version %}
Fix version{{ rem.fix_version }}
{% endif %} {% if rem.workaround %}
Workaround{{ rem.workaround }}
{% endif %}
{% endif %}
{# 7. Evidence — prose proof + typed detail. reason_summary shown only if it differs from the proof prose (kills the v1 dup-sentence bug). #}
Evidence
{{ evidence_block_v2(ev) }} {% if v.reason_summary and v.reason_summary != ev.evidence_summary %}

{{ v.reason_summary }}

{% endif %} {# Audit trail — citations demoted behind a disclosure. Internal keeps inline_excerpt; external was re-stripped by the transform. #} {% set citations = card.citations or [] %} {% if citations %}
Evidence trail ({{ citations | length }}) {% for c in citations %}
{{ c.claim }}
{{ c.evidence_type }}{% if c.checksum %} · {{ c.checksum }}{% endif %}
{# inline_excerpt is internal-only. The transform already re-strips it for external; this mode-guard is belt-and- suspenders so the macro can't leak it independently. #} {% if mode == 'internal' and c.inline_excerpt %}
{{ c.inline_excerpt }}
{% endif %}
{% endfor %}
{% endif %} {# Internal-only telemetry. The transform strips card.internal for external, so this whole block never renders in a shareable report. #} {% if mode == 'internal' and card.internal %} {% set ic = card.internal %}
Verifier internals {% if ic.raw_confidence is not none %}
Raw (uncalibrated) confidence{{ (ic.raw_confidence|float * 100)|round(0)|int }}%
{% endif %} {% if ic.tier_provenance %}
Tier provenance{{ ic.tier_provenance }}
{% endif %} {% if ic.cost_actuals %}{% set ca = ic.cost_actuals %}
Cost{% for k, n in ca.items() %}{{ k }}={{ n }}{% if not loop.last %}, {% endif %}{% endfor %}
{% endif %}
{% endif %}
{# 8. Replay — per-card handle; null bundle = call-graph evidence. #}
{% if prov.bundle_id %} Replay: {{ prov.bundle_id }}{% if prov.sealed_at %} · sealed {{ prov.sealed_at }}{% endif %}
Reproduce: replay_pen_test {{ prov.bundle_id }} {% else %} Call-graph / version evidence — no sealed replay bundle.{% if prov.sealed_at %} Analyzed {{ prov.sealed_at }}.{% endif %} {% endif %}
{%- endmacro %} {# version_table(cards) — AFFECTED_BY_VERSION renders as a compact table, not N cards (spec §5). KEV called out; fix-version column. #} {% macro version_table(cards) -%}
{% for c in cards %} {% set t = c.target or {} %}{% set e = c.enrichment or {} %}{% set rem = c.remediation or {} %} {% endfor %}
CVEComponentSeverityFlagsFix in
{{ t.cve_id }}{% if t.cve_description %}
{{ t.cve_description }}
{% endif %}
{{ t.component_name }}{% if t.component_version %} {{ t.component_version }}{% endif %} {% if e.severity %}{{ e.severity }}{% endif %} {% if e.kev %}CISA KEV{% endif %}{% if e.vckev %}VulnCheck KEV{% endif %} {{ rem.fix_version | default('—') }}
{%- endmacro %} {# decision_summary(summary, bucket_counts) — §1 one-screen decision. #} {% macro decision_summary(summary, bucket_counts) -%} {% set s = summary or {} %}{% set bc = bucket_counts or {} %}
{% if s.headline %}

{{ s.headline }}

{% endif %}
{% if bc.exploitable %}{{ bc.exploitable }} must-fix exploitable{% endif %} {% if bc.affected_by_version %}{{ bc.affected_by_version }} affected by version{% endif %} {% if bc.inconclusive %}{{ bc.inconclusive }} tested inconclusive{% endif %} {% if bc.not_affected %}{{ bc.not_affected }} proven not affected{% endif %} {% if bc.verifier_failed %}{{ bc.verifier_failed }} could not assess{% endif %}
{% if s.actions %}
    {% for a in s.actions %}
  1. {{ a.title }} {% if a.detail %}{{ a.detail }}{% endif %}
  2. {% endfor %}
{% endif %}
{%- endmacro %} {# section(buckets, key, title, mode) — render a card bucket as a titled section, omitted entirely when empty (spec §4 graceful degradation). #} {% macro card_section(buckets, key, title, mode) -%} {% set cards = buckets.get(key) or [] %} {% if cards %}

{{ title }} {{ cards | length }}

{% for card in cards %}{{ verdict_card_v2(card, mode) }}{% endfor %}
{% endif %} {%- endmacro %}