Incorrect access check for 'view label' permission

Created on 8 September 2025, 13 days ago

Problem/Motivation

A recent security fix introduced a regression that affects facets for custom entities. The access check was updated, but it now causes facets to be hidden from anonymous users.

This happens because the new check uses a generic 'view' operation instead of the more specific 'view label' operation, which is the correct permission for this context. Entities that have a custom viewLabelOperation property are affected, as the permission check fails even when users have the necessary access to view the entity label.

Steps to reproduce

  1. Create a custom entity with a defined viewLabelOperation.
  2. Set up a facet that uses this custom entity.
  3. Ensure that anonymous users have permission to 'view label' but not 'view'.
  4. Navigate to the page with the facet as an anonymous user.
  5. Observe that the facet is not visible.

Proposed resolution

The solution is to change the access check to use the more specific 'view label' operation, which is the correct permission for this context.

Change the line:
$access_result = $access->access($entity, 'view', return_as_object: TRUE);
to:
$access_result = $access->access($entity, 'view label', return_as_object: TRUE);
This adjustment will ensure that the access check correctly validates against the appropriate permission, allowing facets for custom entities with viewLabelOperation to be visible to users who have the correct permissions.

Remaining tasks

  • Create a patch with the proposed resolution.
  • Review the patch to ensure it resolves the issue without introducing new regressions.

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇨🇱Chile Aneida

Live updates comments and jobs are added and updated live.
  • Regression

    It restores functionality that was present in earlier versions.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024