Semantics of `mkFsPath` inconsistent between instances and vulnerable in IO
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- haskell
- Área
- operating-systems, security
Línea de trabajo
Comience leyendo la descripción de FsPath y los puntos de entrada mkFsPath y fsPathToFilePath, comparando el comportamiento de los sistemas de archivos reales y simulados. Defina y verifique el escape específico de cada plataforma para que las rutas permanezcan contenidas en el punto de montaje y sean coherentes entre instancias, incluido el ejemplo ["/", "etc", "passwd"].
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Haskell
- Estrellas
- 2
- Forks
- 6
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 IntersectMBO/fs-sim
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
IntersectMBO/fs-sim#137 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 45/100
IntersectMBO/fs-sim#136 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
IntersectMBO/fs-sim#135 ·
-
No 0.4.1.0 tagAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 55/100
IntersectMBO/fs-sim#125 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
IntersectMBO/fs-sim#122 ·
Todos los issues de IntersectMBO/fs-sim
Issues similares
-
Allow QuickCheck 2.17Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 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
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Huerte/algo-solutions-python#260 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
IntersectMBO/cardano-ledger#6276 ·
Los mantenedores suelen responder en 1 día