Generated with the help of an LLM.
Problem/Motivation
The entity_embed.edit_embedded_entity route (/entity-embed/edit-embedded/{type}/{uuid}) has _access: 'TRUE'. Anyone, including anonymous users, can request it: for an existing entity it redirects to the entity's edit form, which reveals that the entity exists and what its ID is. The edit form still checks access, so this doesn't let anyone edit an entity they couldn't before.
Follow-up from #3402443: PHP error: Call to a member function id() on null.
Proposed resolution
Return a 403 unless the current user has update access to the entity, checked in EditEmbeddedEntity::edit() or with a custom access check on the route. Keep the 404 for entities that don't exist or have no edit form.
Remaining tasks
- Add the access check and a test for a user without update access.
Issue fork entity_embed-3639532
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dave reidComment #3
aayushpathak commentedWorking on it !
Comment #5
aayushpathak commentedimplemented the update access check in EditEmbeddedEntity::edit() to throw a 403 (AccessDeniedHttpException) when the user cannot update the entity. and also Added the regression test for unprivileged users and updated the route comment.