Semantics of `mkFsPath` inconsistent between instances and vulnerable in IO
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- haskell
調査の方向性
まず FsPath の説明と mkFsPath および fsPathToFilePath のエントリーポイントを読み、実際のファイルシステムとシミュレートされたファイルシステムの動作を比較します。パスがマウントポイント内に留まり、インスタンス間で一貫するように、プラットフォーム固有のエスケープを定義して検証します。これには ["/", "etc", "passwd"] の例も含まれます。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Haskell
- スター
- 2
- フォーク
- 6
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
IntersectMBO/fs-sim のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
IntersectMBO/fs-sim#137 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 45/100
IntersectMBO/fs-sim#136 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
IntersectMBO/fs-sim#135 ·
-
No 0.4.1.0 tagオープン
難易度 1/5 1時間未満 初心者へのやさしさ 55/100
IntersectMBO/fs-sim#125 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 48/100
IntersectMBO/fs-sim#122 ·
IntersectMBO/fs-sim の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 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
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
Huerte/algo-solutions-python#260 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
IntersectMBO/cardano-ledger#6276 ·
メンテナーはふだん 1 日以内に返信