Upload routes inherit the Get operation's security, not Patch's
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- PHP
- Stelle
- 32
- Fork
- 8
- Merge medio
- 1h 11m
- PR unite (30g)
- 123
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di components-web-app/api-components-bundle
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
components-web-app/api-components-bundle#333 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
components-web-app/api-components-bundle#325 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
components-web-app/api-components-bundle#259 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
components-web-app/api-components-bundle#186 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di components-web-app/api-components-bundle
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Author mapping step: "create new user" and "assign to existing user" fields have no spacing between themForse già presa @umeshnevase l’ha presa oggi. Aperta
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
WordPress/wordpress-importer#275 ·
-
security/openvpn-legacy: read-only user can stop a running VPNForse già presa @besendorf l’ha presa oggi. Apertaincomplete
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
opnsense/plugins#5887 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
jira-created
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100