Add SARIF reporting support
Summary
- Add SARIF 2.1.0 report generation for Strix vulnerability findings with GitHub code scanning-compatible locations and rules.
- Add
--sarif/--sarif-outputCLI flags and write SARIF before non-interactive exit code2so CI uploads can run withif: always(). - Document a GitHub Actions upload flow and cover unsafe/locationless finding handling with regression tests.
Validation
uv run pytest -q→ 118 passed, 4 warningsuv run mypy strix/telemetry/sarif.py strix/interface/main.py→ successuv run pyright strix/telemetry/sarif.py→ 0 errorsuv run ruff check strix/telemetry/sarif.py strix/interface/main.py tests/telemetry/test_sarif.py tests/interface/test_sarif_cli.py→ all checks passed
Notes
- Locationless findings and dropped unsafe locations are summarized in SARIF run properties instead of creating invalid GitHub alerts.
- Unsafe paths, URI-scheme paths, absolute paths, parent traversal, and invalid line ranges are rejected.
Hi @Seongho-Bae — heads up on parallel development.
We independently shipped a SARIF emitter at the same path (strix/telemetry/sarif.py) on a personal fork this week (ours went up 2026-05-07; yours 2026-05-05). Same file, same intent, different specifics. No ego on our side about which lands — yours is cleaner in several places where ours wasn't:
- explicit
--sarif/--sarif-outputCLI flags - write-before-non-interactive-exit-2 so
if: always()upload works in GitHub Actions _sarif_uripath-safety rejection (URI-scheme, absolute,.., invalid line ranges)locationlessFindingssummary inrun.propertiesrather than invalid alerts- mypy / pyright / ruff clean
I built a combined branch that takes your two commits as the base and layers our additions on top: seanturner83/strix:feat/sarif-combined. Preserves your authorship on the foundation. All your tests pass unchanged except one assertion I had to update for a properties.strix.* namespacing change (see below). Ours adds:
- CWE normalisation. Strix findings ship CWE as
CWE-306,cwe:306, or bare306depending on the agent's output variant. Without normalisation the same weakness across runs dedups into separate rules. One helper (_normalise_cwe) collapses them to canonicalCWE-NNNform. - Rule-level GitHub code-scanning properties.
rule.defaultConfiguration.level,rule.properties.security-severity(CVSS→0.0-10.0 string that drives alert ranking),rule.properties.tags(security + CWE-NNN + CVE-…),rule.helpUri→cwe.mitre.org. Without these, alerts show at GitHub's default severity with no tag filter. - PoC namespacing. Moving exploit payloads under
result.properties.strix.pocrather than flat onresult.properties, so generic SARIF UI consumers don't surface exploit text to triage audiences by default.result.properties.security-severitystays top-level because that's where GitHub reads it. (This is the one breaking change to your test suite — the commit updatestest_build_sarif_maps_code_location_and_metadatato match, rationale in the commit body.) - Backwards-compat aliases (
build_sarif_document,write_sarif(run_dir, reports)) so internal callers can use either entry point. - Tracer-sidecar hook in
strix/telemetry/tracer.pythat writesfindings.sarifautomatically on every run, orthogonal to your--sarifCLI flag. Failure to emit SARIF never blocks the primary CSV+MD path. Useful for consumers that want SARIF as a default, without needing a flag on every invocation. - Three real SARIF example files from SAST / DAST / crystal-box runs against OWASP Juice Shop, committed under
docs/sarif-examples/so reviewers can eyeball actual output + upload to GitHub code-scanning to see the alert rendering.
State on the combined branch: 17 SARIF tests pass (10 from your PR unchanged + 7 new), 35 tracer-adjacent tests pass, ruff clean, mypy clean, 0 new warnings.
Three ways I can help:
- I open a PR from
seanturner83:feat/sarif-combined→ your branch (Seongho-Bae:feature/sarif-support), stacking our additions on your commits. You'd merge that into your branch; #477 then carries the combined result for maintainers to review. Keeps everything in one thread and preserves your authorship on the foundation. - I paste the diffs here as a comment and you pull in whichever bits you want into #477 directly. Authorship on the additions stays with me via the commit chain on
feat/sarif-combined, but the final merged PR is yours. - I open a separate PR to
usestrix:mainthat explicitly acknowledges yours, credits the foundation, and notes it should be merged after #477. Less collaborative but independent of your availability.
My preference is (1), falling back to (2) or (3) based on what works for you. No urgency, but if I don't hear back in about a week I'll default to (3) so the work isn't blocked indefinitely — happy to revise on your request after that.
Combined branch for your review: https://github.com/seanturner83/strix/tree/feat/sarif-combined
Hi @Seongho-Bae — heads up on parallel development.
We independently shipped a SARIF emitter at the same path (
strix/telemetry/sarif.py) on a personal fork this week (ours went up 2026-05-07; yours 2026-05-05). Same file, same intent, different specifics. No ego on our side about which lands — yours is cleaner in several places where ours wasn't:
- explicit
--sarif/--sarif-outputCLI flags- write-before-non-interactive-exit-2 so
if: always()upload works in GitHub Actions_sarif_uripath-safety rejection (URI-scheme, absolute,.., invalid line ranges)locationlessFindingssummary inrun.propertiesrather than invalid alerts- mypy / pyright / ruff clean
I built a combined branch that takes your two commits as the base and layers our additions on top:
seanturner83/strix:feat/sarif-combined. Preserves your authorship on the foundation. All your tests pass unchanged except one assertion I had to update for aproperties.strix.*namespacing change (see below). Ours adds:
- CWE normalisation. Strix findings ship CWE as
CWE-306,cwe:306, or bare306depending on the agent's output variant. Without normalisation the same weakness across runs dedups into separate rules. One helper (_normalise_cwe) collapses them to canonicalCWE-NNNform.- Rule-level GitHub code-scanning properties.
rule.defaultConfiguration.level,rule.properties.security-severity(CVSS→0.0-10.0 string that drives alert ranking),rule.properties.tags(security + CWE-NNN + CVE-…),rule.helpUri→cwe.mitre.org. Without these, alerts show at GitHub's default severity with no tag filter.- PoC namespacing. Moving exploit payloads under
result.properties.strix.pocrather than flat onresult.properties, so generic SARIF UI consumers don't surface exploit text to triage audiences by default.result.properties.security-severitystays top-level because that's where GitHub reads it. (This is the one breaking change to your test suite — the commit updatestest_build_sarif_maps_code_location_and_metadatato match, rationale in the commit body.)- Backwards-compat aliases (
build_sarif_document,write_sarif(run_dir, reports)) so internal callers can use either entry point.- Tracer-sidecar hook in
strix/telemetry/tracer.pythat writesfindings.sarifautomatically on every run, orthogonal to your--sarifCLI flag. Failure to emit SARIF never blocks the primary CSV+MD path. Useful for consumers that want SARIF as a default, without needing a flag on every invocation.- Three real SARIF example files from SAST / DAST / crystal-box runs against OWASP Juice Shop, committed under
docs/sarif-examples/so reviewers can eyeball actual output + upload to GitHub code-scanning to see the alert rendering.State on the combined branch: 17 SARIF tests pass (10 from your PR unchanged + 7 new), 35 tracer-adjacent tests pass, ruff clean, mypy clean, 0 new warnings.
Three ways I can help:
- I open a PR from
seanturner83:feat/sarif-combined→ your branch (Seongho-Bae:feature/sarif-support), stacking our additions on your commits. You'd merge that into your branch; #477 then carries the combined result for maintainers to review. Keeps everything in one thread and preserves your authorship on the foundation.- I paste the diffs here as a comment and you pull in whichever bits you want into #477 directly. Authorship on the additions stays with me via the commit chain on
feat/sarif-combined, but the final merged PR is yours.- I open a separate PR to
usestrix:mainthat explicitly acknowledges yours, credits the foundation, and notes it should be merged after #477. Less collaborative but independent of your availability.My preference is (1), falling back to (2) or (3) based on what works for you. No urgency, but if I don't hear back in about a week I'll default to (3) so the work isn't blocked indefinitely — happy to revise on your request after that.
Combined branch for your review: https://github.com/seanturner83/strix/tree/feat/sarif-combined
Hi, @seanturner-zh ! Please make PR(s) on your preference, I'll happy to support you. :)
Thanks sm -- merging #626