SARIF artifact URIs are not percent-encoded and can be absolute across drives

Offen Anfängerfreundlich
#104 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
86/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
node.js, typescript
Bereich
devtools

Rechercherichtung

Lies src/sarif.ts um die Zeilen 46–49 und die zugehörigen Fälle in test/sarif.test.ts. Führe zunächst die SARIF-Tests aus und decke dann die Prozentkodierung in Artefaktpfaden ab, einschließlich Fix-URIs und des win32-Falls mit unterschiedlichen Laufwerken. Fertig ist die Arbeit, wenn die Akzeptanzkriterien erfüllt sind, einschließlich des Weglassens von uriBaseId für die resultierende file:-URI.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug good first issue severity: medium

Summary

SARIF artifactLocation.uri values are emitted without percent-encoding. When the project and the cwd are on different Windows drives, the URI is also an absolute path that is still tagged uriBaseId: %SRCROOT%.

Where

  • src/sarif.ts:46-49 (also used for fixes[].artifactChanges[].artifactLocation.uri)

Details

uri: toPosix(relative(cwd, join(projectRoot, f.file))),
uriBaseId: "%SRCROOT%",

my dir#1/a b%.gd becomes my dir#1/a b%.gd, where # starts a URI fragment and % begins a broken escape. Run from E:\ against a project on C:\, the result is C:/Users/.../a b%.gd under %SRCROOT%.

Impact

Code-scanning uploads can misplace or drop annotations for files whose paths contain spaces, #, % or non-ASCII characters. Godot project folders often contain spaces.

Suggested fix

  • Encode each path segment with encodeURIComponent and join with /.
  • When the relative path is absolute (cross-drive), emit pathToFileURL(full).href with no uriBaseId.
  • Decide whether a path starting with .. keeps the relative form or becomes a file: URI, and document it.

Acceptance criteria

  • my dir/a#b%.gd gives uri === "my%20dir/a%23b%25.gd".
  • A cross-drive case on win32 gives a file:/// URI with no uriBaseId.
  • Fix URIs use the same encoding.

Getting started

  • Relevant files: src/sarif.ts, test/sarif.test.ts
  • How to run tests: npm run build && npm test

Filed by repo-audit/full-audit at e836036. Severity: medium. Effort: S. audit-key: bug|src/sarif.ts|toSarif.uri

Vorherrschende Sprache
TypeScript
Sterne
0
Forks
6
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
8

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/godot-correctness-mcp

Alle Issues in TMHSDigital/godot-correctness-mcp

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.