Repository navigation
Conversation
…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
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryAdds reference links and CWE tags to SARIF rules.
Reviews (1) · Last reviewed commit: "fix(sarif): link CVE-keyed rules to NVD ..." · Reviewed by Greptile |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #1576
Part of #1576. Several items in the issue already hold on current
main:defaultConfiguration.levelandfullDescriptionare 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
helpUrifor CVE-keyed rules. A finding with a CVE but no CWE is keyed on the CVE and had no reference link. It now links tohttps://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 nohelpUri, since there is nothing canonical to link to.external/cwe/cwe-NNNtag on CWE rules, next to the existingCWE-NNNtag. That is the form GitHub code scanning (and CodeQL) uses for CWE references, so alerts can be filtered by CWE there.properties.strix.severityis the only lossless severity channel, as suggested in the issue, and describe thehelpUribehaviour.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 asCWE-NNNand 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.pycover the CWE rule (helpUri,external/cwe/cwe-639tag,defaultConfiguration), the CVE rule linking to NVD, and a rule with no reference id having nohelpUri. The fullpytestsuite passes apart from 18 failures intests/test_runner_*.pythat fail identically onmain(see #1577), andruff check,ruff format --checkandmypyare clean onstrix/report/sarif.py.