Problem/Motivation
Since #2692091: Use the new 'view label' entity access check in the entity reference label formatter the entity access check in the entity reference label formatter uses the "view label" operation.
AFAICT the change did not take the use case into account where the entity's label may be viewed, but the entity itself not, in conjunction with the show as link option.
If you configure the entity reference label formatter to output the referenced entities as links, it will also generate links to entities for which the user doesn't have access to. Clicking on this link will render an access denied page.
I would expect no links to be displayed for these entities and instead only the label.
Proposed resolution
Before creating a link to the entity, check if the user can actually view the entity.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3246579-2.patch | 783 bytes | rp7 |
Comments
Comment #2
rp7 commentedPatch attached could be a possible solution. Still needs a test, though.
Would love some insights as I might be overseeing something completely.
Comment #3
rp7 commentedComment #4
berdirMakes sense. If you are using this for user entities then there's also the author formatter that uses the username template which basically does the same, but that will only work for users.
Comment #5
larowlanThis feels like a feature request to me - thoughts?
Comment #7
john.oltman commentedNo, this is a bug. In fact, it's a security issue, as links to entities can reveal data about the entity that a site admin went to some lengths to protect. For example, depending on how a path alias is constructed, a link can reveal the entity ID, entity type, and potentially other fields as well.
Comment #8
john.oltman commentedComment #11
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
Since this is a bug it will need a test case to show the issue.
Thanks!
Comment #13
kksandr commentedI am closing this issue, since there is a similar one, but with a covered test and RBTC status.