Repository navigation
fix: decode SARIF location URIs in diff-informed alert filtering - #4283
Open
sam-robson wants to merge 1 commit into
Open
sam-robson wants to merge 1 commit into
sam-robson wants to merge 1 commit into
Conversation
sam-robson
force-pushed
the
sam-robson/decode-diff-informed-sarif-uris
branch
2 times, most recently
from
November 2, 2026 16:00
8b728b0 to
c15b59e
Compare
sam-robson
force-pushed
the
sam-robson/decode-diff-informed-sarif-uris
branch
from
November 2, 2026 16:04
c15b59e to
b05fe69
Compare
sam-robson
marked this pull request as ready for review
November 2, 2026 16:35
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain, so the URI-decoding and fallback changes are ready for approval.
No open issues 🎉
1 file not reviewed
lib/entry-points.js: Excluded by your content exclusion settings
What changed in this PR
This pull request fixes diff-informed SARIF alert filtering by decoding percent-encoded artifact URIs before comparing them with raw GitHub diff paths, while preserving raw URI fallback behavior.
Changes:
- Decode SARIF location URIs before diff-range matching.
- Preserve raw matching for unencoded and malformed URIs.
- Add unit coverage for encoded paths, special characters, Unicode, related locations, line ranges, and malformed URIs.
- Document the filtering correction.
| File | Description |
|---|---|
unreleased-change-notes/decode-diff-informed-sarif-uris.md |
Documents the corrected alert-filtering behavior. |
src/upload-lib.ts |
Decodes SARIF location URIs and compares decoded and raw paths during filtering. |
src/upload-lib.test.ts |
Adds coverage for encoded, raw, related, and malformed URI cases. |
Review effort: Lite (auto)
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.
filterAlertsByDiffRangecompares SARIFartifactLocation.urivalues against changed file paths from GitHub's diff API (range.path). CodeQL percent-encodesartifactLocation.uriin SARIF, whilerange.pathis a raw file path, so alerts in files with spaces, non-ASCII characters, or special characters were dropped during diff-informed filtering.Decode
locationUriwithdecodeURIComponentbefore matching againstrange.path, while keeping the rawlocationUricheck for unencoded paths or malformed percent sequences.filterAlertsByDiffRange(sarifLog) readDiffRangesJsonFile() -> range.path ("with space/board.js") for each result location locationUri = physicalLocation.artifactLocation.uri ("with%20space/board.js") + decodedLocationUri = decodeURIComponent(locationUri) ("with space/board.js") - match range.path === locationUri + match range.path === decodedLocationUri || range.path === locationUriRisk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.upload-sarifaction.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist