Original report from @Berdir, copied from the private security tracker and made public as this issue requires "administer node" permissions:
This module has a access bypass (?) vulnerability.
I noticed that \Drupal\node\Plugin\views\filter\Access checks the administer nodes permission to bypass node access, but since 7.x, there is actually a dedicated permission for that (bypass node access).
That could be a possible security issue if you have users with administer nodes that are however not allowed to see all content and you use that filter in combination with having the default node access/alter disabled (I guess that filter only makes sense in that scenario).
Discussed with @dawehner a bit, and Views 7.x has basically the same code.
That said, we're not even sure this class works at all in 8.x (it probably does in 7.x), there were no tests that we could see.
Opening this so I don't forget about this. We need to check if the plugin actually works.
Note that administer nodes is a restrict access permission, so you could argue that this is not a security issue, but there is a reason bypass node access was separated into another permission.
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | incorrect_permission-2799209-18.patch | 10.6 KB | catch |
| #21 | incorrect_permission-2799209-21.patch | 31.34 KB | catch |
| #21 | incorrect_permission-2799209-21-test-only.patch | 9.96 KB | catch |
| #18 | incorrect_permission-2799209-18.patch | 10.6 KB | lendude |
| #18 | interdiff-2799209-14-18.txt | 2.92 KB | lendude |
Comments
Comment #2
gregglesThis was reported and discussed in private and deemed to be OK to be worked on in public given it requires the "attacker" to have administer nodes.
Comment #3
lendudeI was looking at writing a test for this, but even when the node table is not the base table, node access is checked anyway. Adding this filter to the test view didn't change anything.
So is there a scenario where this filter might actually be useful?
Comment #4
dawehnerIts useful for checking edit access.
Comment #5
berdirnot sure but I think we still actually require tests to be suffixed with *Test, no?
Comment #6
berdirI think you need to disable this for this to make sense.
Comment #7
berdir@dawehner: the filter is hardcoded to view, so you can't really use it for edit checking?
I'd say a use case would to combine it with OR conditions. And for some reason, you only want to respect node access for one of the cases.
Comment #8
manuel garcia commentedAddressing #5 and #6
Comment #10
lendudeAh yeah ok that makes sense, you want to disable all rewriting but still want to use the grant table.
Ok so now with the access filter added to the view and the correct permission set in the fix.
Comment #13
dawehnerIs there a reason we shouldn't use the API to create those nodes?
Wait, this is confusing, why are we creating a view of users?
Comment #14
lendude13.1 lazy copy/pasting existing tests, so no GOOD reason :) Changed
13.2 Well the help text for the handler says "Not necessary if you are using node as your base table.", so I started with a different base table when I wanted to test this. But the help text is obviously wrong, so now I changed it to a straight up node view. Should we change the help text here too or do a follow up?
Comment #15
dawehnerSome nitpicks :)
Let's get rid of all that whitespace.
Nitpick: one more space between
(int)and$nodeIt is weird to reuse an existing variable name
Comment #16
lendudeThanks for the review as always.
Fixed all the feedback.
Comment #18
lendudeOk time for bed obviously.....now a patch with some actual content...
Comment #19
berdirThose were just nitpicks, so I think this is good to go?
Comment #20
dawehner+1 for the RTBC
Comment #21
catchUploading a test only patch to see the test fail.
Comment #23
catchBerdir correctly pointed out the other patch wasn't a patch.
Comment #25
berdirBack to RTBC then...
Comment #26
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!