You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deduplicates SARIF rules by problem ID in UFM output to fix duplicate rule entries. When multiple findings share the same problem ID (e.g., two generic-api-key secrets found in different files), the SARIF output previously emitted one rule per finding, producing duplicate rule IDs in the rules array. Per the SARIF v2.1.0 spec, rule IDs must be unique within the rules array.
The fix adds a deduplicateIssuesByProblemID template function that filters the issues list to one entry per unique problem ID (first-wins) for the rules loop only. The results loop is unchanged — all findings still appear as individual results referencing their shared rule.
The deduplicateIssuesByProblemID function performs a 'first-wins' deduplication based on problem ID. If two findings share a problem ID but have different metadata used by SARIF rule generation functions (like different severities or CVSS scores extracted via getRuleCVSSScore or buildRuleShortDescription), the SARIF rule definition will only reflect the metadata of whichever finding appeared first in the input list. While this satisfies the SARIF requirement for unique rule IDs, it may result in inaccurate rule descriptions if the findings are not perfectly identical in their vulnerability definitions.
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
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.
Description
Deduplicates SARIF rules by problem ID in UFM output to fix duplicate rule entries. When multiple findings share the same problem ID (e.g., two
generic-api-keysecrets found in different files), the SARIF output previously emitted one rule per finding, producing duplicate rule IDs in therulesarray. Per the SARIF v2.1.0 spec, rule IDs must be unique within therulesarray.The fix adds a
deduplicateIssuesByProblemIDtemplate function that filters the issues list to one entry per unique problem ID (first-wins) for therulesloop only. Theresultsloop is unchanged — all findings still appear as individual results referencing their shared rule.Relevant ticket: CLI-1344
Checklist
make test)make generate)make lint)go get github.com/snyk/go-application-framework@YOUR_LATEST_GAF_COMMITin thecliv2directory.go.modto point to your local GAF code.go mod tidyin thecliv2directory.go.modandgo.sumchanges.