Attachment upload reads outside the os.Root that checked it
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Go
- スター
- 2
- フォーク
- 0
- 平均マージ
- 2時間 50分
- マージ済み PR(30日)
- 52
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
mozilla/markfluence のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
mozilla/markfluence#185 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
mozilla/markfluence#184 ·
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
mozilla/markfluence#181 · コメント 1 件 ·
-
bug
難易度 5/5 1週間以上 初心者へのやさしさ 48/100
mozilla/markfluence#163 ·
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
mozilla/markfluence#162 ·
mozilla/markfluence の issue をすべて見る
似ている issue
-
bug github_actions
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
registrystack/registry-stack#1393 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
JakeChampion/lang#10213 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
oasisprotocol/oasis-sdk#2523 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100