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

未关闭 适合新手
#104 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
86/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
devtools

调研方向

阅读src/sarif.ts第46–49行附近的内容,以及test/sarif.test.ts中的相关用例。先运行SARIF测试,然后覆盖工件路径中的百分号编码,包括修复URI和win32跨驱动器的情况。完成标准是通过验收条件,包括对生成的file: URI省略uriBaseId。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
TypeScript
星标
0
派生
6
平均合并
1 天 21 小时
30 天内合并 PR
8

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/godot-correctness-mcp 的其他 Issue

查看 TMHSDigital/godot-correctness-mcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。