Model tool errors send the absolute host path to the provider when a path contains NUL
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Go
- Estrellas
- 0
- Forks
- 1
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TMHSDigital/Spackle
-
enhancement good first issue severity: low
Dificultad 2/5 Medio día Aptitud para principiantes 72/100
TMHSDigital/Spackle#139 ·
-
enhancement good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
TMHSDigital/Spackle#138 ·
-
documentation good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TMHSDigital/Spackle#135 ·
-
bug good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
TMHSDigital/Spackle#131 ·
-
runs and runs compare print target text without the control-character cleaning the reports useAbiertobug good first issue severity: low
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TMHSDigital/Spackle#129 ·
Todos los issues de TMHSDigital/Spackle
Issues similares
-
bug raised-by:reviewer
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
medici-finance/assay#7655 ·
Los mantenedores suelen responder en 1 día
-
helm chart: make DaemonSet pod affinity configurable via values.yamlPosiblemente ocupada @Young-Zen la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
flannel-io/flannel#2632 ·
Los mantenedores suelen responder en 6 días
-
go-vulnerability security-scan
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
teslashibe/agent-go#36 ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
nwverse/persona#15194 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug flaky-test
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rosskukulinski/tailworks#411 ·
Los mantenedores suelen responder en 1 día