Upload routes inherit the Get operation's security, not Patch's
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- PHP
- Star
- 32
- Fork
- 8
- Merge trung bình
- 1 giờ 11 phút
- Pull request đã merge (30 ngày)
- 123
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của components-web-app/api-components-bundle
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
components-web-app/api-components-bundle#333 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
components-web-app/api-components-bundle#325 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
components-web-app/api-components-bundle#259 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
components-web-app/api-components-bundle#186 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của components-web-app/api-components-bundle
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
jwage/phpamqplib-messenger#163 ·
-
Newsletter subscription page logs Undefined array key "nw_error" on every GETCó thể đã có người làm @Codencode đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 82/100
PrestaShop/ps_emailsubscription#145 · 1 bình luận ·
-
PHP 8.5 CURL deprecatedĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
-
jira-created
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100