Repository navigation
fix(sarif): do not count results marked as suppressed - #9383
Merged
Merged
Conversation
jmkle
requested review from
Kurt-von-Laven,
bdovaz,
echoix and
nvuillam
as code owners
October 29, 2026 09:38
Results whose SARIF suppressions are all accepted (ex: # nosemgrep) are no longer counted as errors or warnings, listed in the human-readable details, or included in the API reporter breakdowns. The SARIF reports keep them untouched. TEST_KEYWORDS=linter_test,mega_linter_3_sarif_test,api_reporter_v2_test Fixes oxsecurity#9373
jmkle
force-pushed
the
fix/sarif-suppressed-results
branch
from
October 29, 2026 20:38
708221c to
423dc17
Compare
Member
|
@jmkle plz can you fix the issues detected by ci jobs ? :) |
Signed-off-by: Joel Klein <113847502+jmkle@users.noreply.github.com>
Contributor
Author
|
@nvuillam I have added |
…dir() Signed-off-by: Joel Klein <113847502+jmkle@users.noreply.github.com>
…zation Signed-off-by: Joel Klein <113847502+jmkle@users.noreply.github.com>
Contributor
Author
|
@nvuillam now the test errors are also resolved :) |
Member
|
Let's go :) |
This branch was successfully 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.
Fixes #9373
With
SARIF_REPORTER: true, MegaLinter counted every result of a linter's SARIF output, including the ones the linter itself marks as suppressed (for example# nosemgrep). They showed up as warnings in the summary, the PR/MR comment and the console details, although the linter passed.Per SARIF 2.1.0 §3.27.23, a suppressed result is excluded from result lists and counts. A result is treated as suppressed when
suppressionsis non-empty and none of its entries hasstatusunderRevieworrejected(§3.35.3). An entry withoutstatusis accepted, which is how semgrep writes in-source suppressions.Proposed Changes
utils_sarif.is_suppressed()helper, plusremove_suppressed_results()/remove_suppressed_results_from_text()that return a filtered copy of the SARIFLinter.get_sarif_result_countand in thecli_lint_errors_count: sarifstdout counting path (DevSkim)sarif-fmtreceives the filtered copy, so the console/text details no longer list suppressed results. The SARIF report files are untouched, so SARIF consumers still see the suppressionsApiReporter.build_sarif_breakdownsskips suppressed results.automation/test/sarif_reports/REPOSITORY_SEMGREP.sarif(one suppressed result, one plain result), plus unit tests for both counting paths, the API breakdowns and the helpers (accepted / underReview / rejected / mixed statuses)Readiness Checklist
Author/Contributor
Reviewing Maintainer
breakingif this is a large fundamental changeautomation,bug,documentation,enhancement,infrastructure, orperformance