Attachment upload reads outside the os.Root that checked it
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Trace the image path through internal/convert/images.go and internal/project/project.go, then inspect LocalAttachment, fileChecksum, and upload handling in internal/client/client.go. Also check how attachment-upload constructs LocalAttachment values. Done means checksum and upload read through the same os.Root that performed the check, with the no-read-outside-root scenario covered by tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
markfluence checks each image through an os.Root but uploads it through an ordinary path, so the check and the read are two different lookups.
The converter checks an image with root.FS.Lstat(rootRel) (internal/convert/images.go). root.FS is an os.Root bounded to the documentation root (internal/project/project.go), so it refuses a symlinked leaf and an escape through a symlinked directory. But the LocalAttachment the converter hands on carries Path: filepath.Join(r.root.Dir, rootRel). fileChecksum and the upload then call os.Open on that path (internal/client/client.go), outside the os.Root.
So if a directory on that path is replaced with a symlink between the check and the upload, the uploaded bytes can come from outside the root. S2 (no-read-outside-root) is meant to rule that out. This is a race, not a static hole: no layout of files on disk triggers it by itself.
A likely fix is to open the file through the same os.Root that checked it, instead of by absolute path. For example, carry the root-relative path and the *os.Root (or an opener) on LocalAttachment. attachment-upload builds LocalAttachment values too, so it would need the same treatment.
- Lenguaje dominante
- Go
- Estrellas
- 2
- Forks
- 0
- Merge medio
- 2 h 50 min
- PR fusionados (30 d)
- 52
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 mozilla/markfluence
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
mozilla/markfluence#185 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
mozilla/markfluence#184 ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
mozilla/markfluence#181 · 1 comentario ·
-
bug
Dificultad 5/5 Más de una semana Aptitud para principiantes 48/100
mozilla/markfluence#163 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
mozilla/markfluence#162 ·
Todos los issues de mozilla/markfluence
Issues similares
-
bug github_actions
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
registrystack/registry-stack#1393 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
JakeChampion/lang#10213 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
oasisprotocol/oasis-sdk#2523 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100