Semantics of `mkFsPath` inconsistent between instances and vulnerable in IO
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- haskell
- Ambito
- operating-systems, security
Direzione di ricerca
Iniziate leggendo la descrizione di FsPath e gli entry point mkFsPath e fsPathToFilePath, confrontando il comportamento dei file system reali e simulati. Definite e verificate l’escaping specifico della piattaforma, in modo che i percorsi rimangano contenuti nel punto di montaggio e coerenti tra le istanze, incluso l’esempio ["/", "etc", "passwd"].
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The semantics of mkFsPath are inconsistent between the real and simulated filesystem instances, as is documented in the description of FsPath.
This inconsistency makes it easy to write code that behaves differently depending on whether or not it runs on a real or simulated filesystem.
This makes it nigh-impossible to write code that is truly known to be invariant over what kind of filesystem it will be evaluated on, since the segments of the FsPath will be interpreted differently by the different instances.
Notably, the code mkFsPath ["/", "etc", "passwd"] will yield an FsPath that is well-behaved in the simulation, but yields a path to /etc/passwd when evaluated with the actual filesystem, regardless of the mount point.
tmpDir <- Dir.getTemporaryDirectory
let mountPoint = tmpDir </> "fs-sim"
let hasFS = ioHasFS (MountPoint mountPoint)
let passwd = mkFsPath ["/", "etc", "passwd"]
putStrLn (unsafeToFilePath passwd)
-- "/etc/passwd"
-- NOT: "/tmp/fs-sim/etc/passwd"
This breaks the encapsulation that the mount point is intended to introduce and introduces an attack vector that can be exploited by any FsPath created from user input or by an unreviewed version of a dependency.
Furthermore, fs-api significantly obfuscates the dangers here.
In my opinion, the fsPathToFilePath function that is used to interpreted FsPath on the real filesystem should escape all characters that have special meaning on the current platform in order to yield consistent behaviour across the API instances and better encapsulation.
- Lingua principale
- Haskell
- Stelle
- 2
- Fork
- 6
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun 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 IntersectMBO/fs-sim
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
IntersectMBO/fs-sim#137 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 45/100
IntersectMBO/fs-sim#136 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
IntersectMBO/fs-sim#135 ·
-
No 0.4.1.0 tagAperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 55/100
IntersectMBO/fs-sim#125 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
IntersectMBO/fs-sim#122 ·
Tutte le issue di IntersectMBO/fs-sim
Issue simili
-
Allow QuickCheck 2.17Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
-
15-minutes 5-minutes algorithm any-language beginner-friendly c cpp csharp easy go good first issue hacktoberfest help wanted java javascript kotlin python rust swift typescript
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
Huerte/algo-solutions-python#260 ·
I maintainer di solito rispondono entro 1 giorno
-
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 65/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
IntersectMBO/cardano-ledger#6276 ·
I maintainer di solito rispondono entro 1 giorno