Problem/Motivation
The hook_entity_access documentation does not really tell us anything that the function header / return type (AccessResultInterface) doesn't.
Most importantly, it does does not document the use of orIf. Since February, the routing system uses andIf solely and not being aware of the difference can lead to a security issue when a shared access check returns a Neutral result instead of a Forbidden because the two make no difference when routing but they do when entity access checking. So this is a security weakness at best -- can a documentation issue be critical? If it can be, this one needs to be.
Proposed resolution
Document it! I already put a note on https://www.drupal.org/node/2122195/revisions/view/8436387/8470706 to denote the difference.
Remaining tasks
Get dawehner to review this and commit it ASAP.
Either here or a followup should discuss what are the possible values of $operation.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | 2490074_7.patch | 1.43 KB | chx |
Comments
Comment #1
chx commentedComment #2
chx commentedComment #3
chx commentedComment #4
chx commentedComment #5
chx commentedComment #6
dawehner<3
Something odd happened here at the end of the sentence!
Comment #7
chx commentedSomething odd -- looks like i started to type "ag service_tags" before switching to console.
Comment #8
dawehnerAh yeah, I assumed something like that.
Comment #9
xjmThanks @chx. This is a great improvement to these docs, and of course it's important for people implementing this hook to understand WTF is going on. ;)
This issue only changes documentation, so per https://www.drupal.org/core/beta-changes, this can be completed any time during the Drupal 8 beta phase. Committed and pushed to 8.0.x.
I tweaked the punctuation slightly on commit: