Model tool errors send the absolute host path to the provider when a path contains NUL
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Go
- Stelle
- 0
- Fork
- 1
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di TMHSDigital/Spackle
-
enhancement good first issue severity: low
Difficoltà 2/5 Mezza giornata Idoneità per principianti 72/100
TMHSDigital/Spackle#139 ·
-
enhancement good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
TMHSDigital/Spackle#138 ·
-
documentation good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/Spackle#135 ·
-
bug good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
TMHSDigital/Spackle#131 ·
-
runs and runs compare print target text without the control-character cleaning the reports useApertabug good first issue severity: low
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
TMHSDigital/Spackle#129 ·
Tutte le issue di TMHSDigital/Spackle
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Default exclude patterns drop production files whose names end in "test" or "spec" (Contest.java, Latest.swift, Aspec.hs)Forse già presa @alex09x l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
alibaba/open-code-review#2078 ·
I maintainer di solito rispondono entro 1 giorno
-
area/docs needs-triage theme/supply-chain
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
podman-container-tools/container-libs#1393 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
limitlessprojects/Go-Hybrid#4764 ·
I maintainer di solito rispondono entro 1 giorno