Attachment upload reads outside the os.Root that checked it
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Go
- Stelle
- 2
- Fork
- 0
- Merge medio
- 2h 50m
- PR unite (30g)
- 52
Guida per i contributori
Apri 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 mozilla/markfluence
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
mozilla/markfluence#185 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
mozilla/markfluence#184 ·
-
bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
mozilla/markfluence#181 · 1 commento ·
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 48/100
mozilla/markfluence#163 ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
mozilla/markfluence#162 ·
Tutte le issue di mozilla/markfluence
Issue simili
-
nix: vendorHash is outdated Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
-
Bob Shell support Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
santhosh-tekuri/jsonschema#276 ·