Skip to content

feat(sarif): describe the rules and rate each finding's confidence - #31

Merged
SizzleUnrlsd merged 9 commits into
mainfrom
feat/describe-rules-and-confidence
Oct 23, 2026
Merged

SizzleUnrlsd merged 9 commits into
mainfrom
feat/describe-rules-and-confidence

Conversation

@SizzleUnrlsd

Copy link
Copy Markdown
Contributor

Closes #29. Closes #30.

The SARIF log said nothing about its rules and nothing about how sure a finding is. A consumer such as GitHub code scanning, an IDE or CoreTrace's merged log could only show a finding's bare rule id.

Changes

  • Rules (SARIF: list and describe the rules in tool.driver.rules #29):
    • DescribeRule gives a title and a description for each of the eleven rules ParseFindings reports. The texts sit next to where the rules are defined, in src/findings.cpp.
    • tool.driver.rules lists each rule a run reports once, in the order first reported, with shortDescription (the title) and fullDescription (the description). An empty run has an empty rules array.
  • Confidence (SARIF: rate each finding's confidence #30): each rule has a confidence, and each result carries it as properties.confidence, spelled as CoreTrace's merged log spells it:
    • high for a fault observed while the program ran (bounds, use after free, double free, leak, and the vtable faults);
    • medium for vtable-type-mismatch, which may be a legitimate cast;
    • low for vtable-diagnostic, the fallback for a vtable report without a more specific rule.

CoreTrace reads this log. With CoreTrace/coretrace#208, it already keeps a rule's description, so nothing else is needed on its side for #29. Reading the confidence and the allocation site is CoreTrace/coretrace#209.

Tests

Each test was committed before its implementation and failed for the expected reason:

  • sarif_unit: each of the eleven rules is listed once, with a title other than its id and a description. The confidence is checked for each level.
  • The exact logs sarif_unit already compared against now list their rule and carry the confidence: they changed with the format.

Results:

  • Full suite on macOS (Apple silicon, LLVM 20, Release): 17/17.
  • sweep_runs timed out once under a parallel ctest -j 8 (156 s) and passed alone (17 s): it runs every fixture with a 10 s limit.
  • scripts/format-check.sh is clean.
  • Linux is verified by CI only.

The SARIF log has no tool.driver.rules: a consumer such as GitHub code scanning or CoreTrace's merged log can only show the bare rule id. Each of the eleven rules the analyzer reports must be listed once, with a title other than its id and a description.

Refs #29
A fault observed while the program ran is certain (high); a vtable type mismatch may be a legitimate cast (medium); an unrecognized vtable report says little (low). The SARIF result must carry it as the confidence property, as CoreTrace's merged log spells it.

Refs #30
DescribeRule gives a title and a description for each of the eleven rules ParseFindings reports, next to where they are defined, for a SARIF consumer to explain their findings.

Refs #29
The driver had no rules, so a consumer could only show a finding's bare rule id. tool.driver.rules now lists each rule the run reports once, in the order first reported, with its title as shortDescription and its description as fullDescription. The exact logs the tests compare against list those rules, and an empty run an empty rules array.

Refs #29
A fault observed while the program ran is certain (high); a vtable type mismatch may be a legitimate cast (medium); an unrecognized vtable report says little (low).

Refs #30
Each result carries its rule's confidence as the property confidence, low, medium or high, as CoreTrace's merged log spells it. The exact logs the tests compare against carry it next to the CWE.

Refs #30
@SizzleUnrlsd SizzleUnrlsd added enhancement New feature or request priority: high Review first labels Oct 22, 2026
@SizzleUnrlsd SizzleUnrlsd self-assigned this Oct 22, 2026
A program built with -fno-rtti has no typeinfo in its vtables, so the
runtime logs "missing typeinfo" for valid virtual calls. The parser
mapped it to vtable-corrupted, an error rated high confidence.

Move it last in the vtable rules as a vtable-diagnostic warning, so any
other warning of the same box still decides the rule, and drop "type
information" from the vtable-corrupted description.
@SizzleUnrlsd
SizzleUnrlsd merged commit a726198 into main Oct 23, 2026
7 checks passed
@SizzleUnrlsd
SizzleUnrlsd deleted the feat/describe-rules-and-confidence branch October 23, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: high Review first

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SARIF: rate each finding's confidence SARIF: list and describe the rules in tool.driver.rules

1 participant