Skip to content

Commit e8403cf

Browse files
Reject all file URIs
1 parent 5ff5384 commit e8403cf

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extensions/ql-vscode/src/variant-analysis/sarif-processing.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,14 @@ function getFilePath(
172172
physicalLocation: sarif.PhysicalLocation,
173173
): string | undefined {
174174
const filePath = physicalLocation.artifactLocation?.uri;
175-
if (filePath === undefined || filePath === "" || filePath === "file:/") {
175+
// We expect the location uri value to be a relative file path, with no scheme.
176+
// We only need to support output from CodeQL here, so we can be quite strict,
177+
// even though the SARIF spec supports many more types of URI.
178+
if (
179+
filePath === undefined ||
180+
filePath === "" ||
181+
filePath.startsWith("file:")
182+
) {
176183
return undefined;
177184
}
178185
return filePath;

0 commit comments

Comments
 (0)