Model tool errors send the absolute host path to the provider when a path contains NUL
還沒有人認領這個 Issue。
評估
研究方向
Read resolve and pathError in internal/agent/tools/tools.go alongside walk.Resolve in internal/walk/walk.go, then run go test ./internal/agent/tools ./internal/walk to see the current behavior. Compare with the control-character check the git tools already use in internal/agent/tools/git.go:41, and extend TestOutsideFileIsNeverReadable in tools_test.go so it asserts on error text, not just content. Done means no tool result, including path-resolution and post-listing removal failures, contains an absolute path.
由索引模型根據 Issue 內容生成。
描述
Summary
The model tools strip host paths from OS errors on purpose ("The full text names host paths, which the model does not need and the provider should not see", internal/agent/tools/tools.go:384-385). Path-resolution errors bypass that: a model-supplied path containing a NUL byte returns an error that includes the absolute path of the operator's checkout, and that error goes to the provider as a tool result.
Where
internal/walk/walk.go:360-366(Resolvewraps theEvalSymlinkserror whole)internal/agent/tools/tools.go:299-302(resolvepasses it topathError)internal/agent/tools/tools.go:376-382(pathErrorkeepserr.Error())internal/agent/tools/tools.go:384-392(reason, which is not used on this path)internal/agent/tools/tools_test.go:770-812(TestOutsideFileIsNeverReadablechecks content, not error text)
Details
// walk.Resolve
resolved, err := filepath.EvalSymlinks(joined)
if err != nil {
if os.IsNotExist(err) { ... }
return "", fmt.Errorf("path %q: %w", untrusted, err)
}
A NUL byte makes Lstat fail with EINVAL, and the *fs.PathError text carries the absolute path. Reproduced with a test using the package's own helpers: read_file {"path":"README.md\u0000"} returned read_file: path "README.md\x00": Lstat <absolute target dir>\README.md : invalid argument; .... list_dir and grep do the same. reason has no test coverage.
Impact
The operator's absolute checkout path, which usually contains their OS user name, is sent to the model provider. Target content can steer the model into making such a call. Low: the provider already receives source code, and nothing but the path leaks.
Suggested fix
- Refuse a path containing NUL or other control characters in
resolve(orwalk.Resolve) before touching the filesystem, as the git tools already do (internal/agent/tools/git.go:41). - Make
pathErrorpass a wrapped*fs.PathErrorthroughreasonso it loses itsPath.
Acceptance criteria
- No tool result contains the absolute target path, for any input.
-
TestOutsideFileIsNeverReadablealso asserts that no result contains the parent directory path. - A unit test of
reasonwith an*fs.PathErrorreturns the cause without the path. - A test where a file is removed after the registry listed it checks that
read_fileandgreperrors name only the relative path.
Getting started
- Relevant files:
internal/agent/tools/tools.go,internal/walk/walk.go,internal/agent/tools/tools_test.go - How to run tests:
go test ./internal/agent/tools ./internal/walk - Related docs:
docs/PRIVACY.md
Filed by repo-audit/full-audit at fffef43. Severity: low. Effort: S. audit-key: privacy|internal/agent/tools/tools.go|pathError
- 主要語言
- Go
- 星號
- 0
- 分支
- 1
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TMHSDigital/Spackle 的其他 Issue
-
enhancement good first issue severity: low
難度 2/5 半天 新手友好度 72/100
TMHSDigital/Spackle#139 ·
-
enhancement good first issue severity: low
難度 2/5 1-3 小時 新手友好度 72/100
TMHSDigital/Spackle#138 ·
-
documentation good first issue severity: low
難度 2/5 1-3 小時 新手友好度 78/100
TMHSDigital/Spackle#135 ·
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 72/100
TMHSDigital/Spackle#131 ·
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 78/100
TMHSDigital/Spackle#129 ·
查看 TMHSDigital/Spackle 的全部 Issue
相似的 Issue
-
bug raised-by:reviewer
難度 2/5 1-3 小時 新手友好度 66/100
medici-finance/assay#7655 ·
維護者通常 1 天內回覆
-
helm chart: make DaemonSet pod affinity configurable via values.yaml可能已有人在做 @Young-Zen 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
flannel-io/flannel#2632 ·
維護者通常 6 天內回覆
-
go-vulnerability security-scan
難度 1/5 1 小時以內 新手友好度 72/100
teslashibe/agent-go#36 ·
-
enhancement
難度 2/5 1-3 小時 新手友好度 72/100
nwverse/persona#15194 · 1 則留言 ·
維護者通常 1 天內回覆
-
bug flaky-test
難度 2/5 1-3 小時 新手友好度 78/100
rosskukulinski/tailworks#411 ·
維護者通常 1 天內回覆