Skip to content

fix(sarif): link CVE-keyed rules to NVD and tag CWE rules for code scanning - #1582

Open
jav1er8 wants to merge 1 commit into
usestrix:mainfrom
jav1er8:fix/sarif-rule-metadata
Open

jav1er8 wants to merge 1 commit into
usestrix:mainfrom
jav1er8:fix/sarif-rule-metadata

Conversation

@jav1er8

@jav1er8 jav1er8 commented Oct 23, 2026 •

Copy link
Copy Markdown

Refs #1576

Part of #1576. Several items in the issue already hold on current main: defaultConfiguration.level and fullDescription are emitted on every rule (_build_rule), and CWE-keyed rules already link to the CWE definition. This PR covers the gaps that are left.

Change

  • helpUri for CVE-keyed rules. A finding with a CVE but no CWE is keyed on the CVE and had no reference link. It now links to https://nvd.nist.gov/vuln/detail/<CVE> when the id is well formed (CVE-YYYY-NNNN…). Rules keyed on a finding id or title slug still have no helpUri, since there is nothing canonical to link to.
  • external/cwe/cwe-NNN tag on CWE rules, next to the existing CWE-NNN tag. That is the form GitHub code scanning (and CodeQL) uses for CWE references, so alerts can be filtered by CWE there.
  • Docstring: the module notes now say that properties.strix.severity is the only lossless severity channel, as suggested in the issue, and describe the helpUri behaviour.

Not included: an artifacts[] index (optional per the issue, and it would touch every location), and changing the severity collapse, which is by design.

On the "389 of 448 rules have no helpUri" figure: the reporting tool already validates CWE values as CWE-NNN and asks the agent to omit the CWE when unsure, so most rules without a link are findings with no CWE at all. Those can only get a link once a CWE is filed.

Tests

New tests in tests/test_sarif.py cover the CWE rule (helpUri, external/cwe/cwe-639 tag, defaultConfiguration), the CVE rule linking to NVD, and a rule with no reference id having no helpUri. The full pytest suite passes apart from 18 failures in tests/test_runner_*.py that fail identically on main (see #1577), and ruff check, ruff format --check and mypy are clean on strix/report/sarif.py.

…anning

Only CWE-keyed rules carried a `helpUri`; a rule keyed on a CVE (a finding
with a CVE but no CWE) gave the reviewer no reference link. Such rules now
link to their NVD entry when the id is a well-formed CVE.

CWE rules also get an `external/cwe/cwe-NNN` tag next to the existing
`CWE-NNN` one. That is the form GitHub code scanning recognises as a CWE
reference, so alerts can be filtered by CWE there.

The module docstring now states that `properties.strix.severity` is the
only lossless severity channel, since the five Strix severities collapse
to three SARIF levels by design.

Refs usestrix#1576
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Adds reference links and CWE tags to SARIF rules.

  • SARIF rules link CVEs to NVD and add GitHub’s CWE tag.

Reviews (1) · Last reviewed commit: "fix(sarif): link CVE-keyed rules to NVD ..." · Reviewed by Greptile

This branch has not been deployed

No deployments
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