Upload routes inherit the Get operation's security, not Patch's
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
調査の方向性
Start with UploadableResourceMetadataCollectionFactory, where the upload route is built from the resource's Get operation. Inspect how security and securityPostDenormalize are assigned, and trace the resource's Patch/Put metadata instead. The change is complete when the generated upload operation inherits the write operation's security and the documented anonymous-upload reproduction is rejected.
索引モデルが issue の本文から書いたものです。
説明
Problem
The bundle builds an uploadable resource's item upload route (POST {iri}/upload) from the resource's Get operation (UploadableResourceMetadataCollectionFactory), so the upload operation gets Get's security. A component with a public Get (the normal case: anyone can read published content) therefore has no operation-level security on uploads. Only the firewall's access_control (component writes admin-only in the template's security.yaml) stops a visitor from replacing a file.
Repro
- Add
#[Silverback\Uploadable]+ an#[UploadableField]to a component whose operations areGet(public) andPatch(security: "is_granted('ROLE_ADMIN')"). - Remove or loosen the
access_controlline for component writes. POST /_api/component/<type>/<id>/uploadas an anonymous user: the upload is accepted.
Fix used locally (Dons Hub)
Restrict Get to reads unless admin, so the derived upload operation is admin-only:
new Get(security: "request === null or request.getMethod() in ['GET', 'HEAD'] or is_granted('ROLE_ADMIN')"),
The proper fix would be for the factory to base the upload operation's security (and securityPostDenormalize) on the resource's Patch/Put operation instead of Get.
- 主要言語
- PHP
- スター
- 32
- フォーク
- 8
- 平均マージ
- 1時間 11分
- マージ済み PR(30日)
- 123
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
components-web-app/api-components-bundle のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
components-web-app/api-components-bundle#333 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#325 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
components-web-app/api-components-bundle#259 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
components-web-app/api-components-bundle#186 ·
メンテナーはふだん 1 日以内に返信
components-web-app/api-components-bundle の issue をすべて見る
似ている issue
-
Recognise PHP_CodeSniffer (`phpcs`) as a linter対応中かも @HarshRajSinghania が今日担当しました。 オープンenhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
MustacheCase/zanadir#507 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
jwage/phpamqplib-messenger#163 ·
-
Newsletter subscription page logs Undefined array key "nw_error" on every GET対応中かも @Codencode が今日担当しました。 オープン
難易度 1/5 1〜3時間 初心者へのやさしさ 82/100
PrestaShop/ps_emailsubscription#145 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
-
jira-created
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信