Currently the Entity Autocomplete module ignore all existing access restriction to the returned entities. This is a big security lack.

Moreover, because the Entity Autocomplete module cannot know all access related tags for all entities, the tags should be added through hook invocation, to give other modules a way to add their custom tags. Entity Autocomplete module could only handle Drupal core access control, so for comment, node, taxonomy and user entity types.

Note: this could be the way satisfy the issue #1494916: Tag the query to be able to identify it in hook_query_alter,

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

recrit’s picture

The attached patch adds the following query tags:
* "entity_autocomplete" for other to alter as needed
* Nodes: "node_access"
* Custom entities: $info['access arguments']['access tag'] defined in hook_entity_info()

recrit’s picture

Status: Active » Needs review
B-Prod’s picture

Status: Needs review » Needs work
Issue tags: +Need tests

@recrit: thanks for your patch!

But the related tests are missing. Could you write those? If not, please assign this issue to me, I will do it as soon as I can.

recrit’s picture

@B-Prod: the ticket is assigned to you. I do not have the time to write the tests.