Skip to content

feat: add findings.json → SARIF 2.1.0 converter - #8

Open
ppcvote wants to merge 1 commit into
cloudflare:mainfrom
ppcvote:feat/sarif-export
Open

feat: add findings.json → SARIF 2.1.0 converter#8
ppcvote wants to merge 1 commit into
cloudflare:mainfrom
ppcvote:feat/sarif-export

Conversation

@ppcvote

@ppcvote ppcvote commented Jul 23, 2026

Copy link
Copy Markdown

What

Adds findings-to-sarif.cjs, a zero-dependency converter from findings.json to SARIF 2.1.0, so audit output plugs directly into GitHub code scanning, VS Code SARIF viewers, DefectDojo, and any other SARIF consumer — no post-processing.

node findings-to-sarif.cjs <output-dir>/findings.json <output-dir>/findings.sarif

Why

The skill already produces excellent structured output, but findings.json uses the skill's own schema. SARIF is the interchange format the surrounding tooling already speaks — emitting it lets a security-audit run surface as annotations on a PR (code scanning) or as navigable results in an IDE without anyone writing glue.

Mapping choices

  • Only confirmed findings become results. rejected findings are excluded from results but counted in run.properties.rejectedFindings, so the adversarial-validation trail stays visible rather than silently dropped.
  • tracecodeFlow. The entrypoint → propagation → sink chain maps to a SARIF codeFlow, which code scanning renders as a step-through path. The sink is the result's primary location — where the defect manifests and where a fix lands.
  • overall_severitylevel + security-severity. critical/higherror, mediumwarning, low/informationalnote; plus the numeric security-severity rule property that drives code scanning's severity buckets.
  • partialFingerprints hash the raw UTF-8 octets of stable identity fields (rule id, sink file/line, root cause), so a finding keeps the same fingerprint across runs and platforms and code scanning can dedupe it.

Notes

  • Zero dependencies, matching validate-findings.cjs. Run the validator first; this converter assumes schema-valid input.
  • Output validated against the OASIS SARIF 2.1.0 schema (confirmed + rejected fixture → codeFlow, severity mapping, fingerprint all check out).
  • Additive only — no change to the existing pipeline, schema, or validator.

Happy to adjust the mapping (e.g. surface conditions/execution differently, or emit one run per hunting class) if you'd prefer a different shape.

Adds findings-to-sarif.cjs so audit output plugs into GitHub code scanning,
VS Code SARIF viewers, and other SARIF consumers without post-processing.

- Confirmed findings become SARIF results; rejected findings are excluded
  but counted in run.properties so the audit trail stays visible.
- Each finding's trace (entrypoint -> propagation -> sink) maps to a SARIF
  codeFlow, rendered by code scanning as a step-through path; the sink is
  the result's primary location.
- overall_severity maps to SARIF level and to the code-scanning
  security-severity rule property.
- partialFingerprints hash the raw UTF-8 octets of stable identity fields,
  so a finding keeps the same fingerprint across runs and platforms.

Zero dependencies, matching validate-findings.cjs. Output validated against
the OASIS SARIF 2.1.0 schema. README updated with a SARIF export section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant