Updated: Comment #15

Problem/Motivation

#1984528: Follow-up: Allow for more robust access checking introduced specific constants for access checkers, primarily to help differentiate between NULL and FALSE.
Most access checkers do not use these yet.

Proposed resolution

Convert all remaining access checkers to use the the new constants

Remaining tasks

N/A

User interface changes

N/A

API changes

N/A

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
FileSize
13.71 KB

Let's see how many are problematic here.

Wim Leers’s picture

In a lot of places in that patch, where FALSE used to be returned, you're now returning static::DENY, but shouldn't that always be static::KILL?

dawehner’s picture

Well, in all of that places I thought that actually static::DENY makes more sense. You wan't to be able to use the access checker with other ones in an ANY access mode.
The only place where I active chosed to use static::KILL
was the csrf token access checker.

tim.plunkett’s picture

No, because more than half the time, the FALSE was wrong.

Status: Needs review » Needs work

The last submitted patch, access-2063405-1.patch, failed testing.

damiankloip’s picture

Yep that patch looks good to me; That's totally right, You can't have a decent access system relying on TRUE/FALSE alone. In most cases why should only one access check be able to block access to a route before everyone else has had a chance?

After the tone of the comments in #1984528: Follow-up: Allow for more robust access checking, you're a good man Daniel.

Wim Leers’s picture

Status: Needs work » Needs review
Issue tags: +DrupalWTF, +WSCCI
FileSize
719 bytes
15.11 KB

#3: that makes sense :)

#6: I apologize if the tone was perceived as harsh. I definitely was very frustrated. But having re-read my comments on that issue, I am reading almost solely observations and questions. Little emotion.


Reroll to fix exceptions, I ran FloodTest locally and it is now fully green, so hopefully the other tests will be too.

Status: Needs review » Needs work

The last submitted patch, access-2063405-7.patch, failed testing.

Wim Leers’s picture

The remaining test failures in Drupal\rest\test\CreateTest look legitimate.

dawehner’s picture

dawehner’s picture

Status: Needs work » Needs review
FileSize
12.88 KB

Removed the change in the CRSFAccessChecker, as this potentially is intended ...

dawehner’s picture

Issue tags: -DrupalWTF, -WSCCI

#11: access-2063405-11.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +DrupalWTF, +WSCCI

The last submitted patch, access-2063405-11.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
12.91 KB

Just a rerole.

andypost’s picture

There's no issue summary at all!

tim.plunkett’s picture

It's almost as easy to write one as it is to add the tag.

dawehner’s picture

tim.plunkett++

andypost’s picture

So looking at the patch suppose that only checkers implementing StaticAccessCheckInterface should be updated?
Please clarify this

dawehner’s picture

No, all of them. The access method is part of AccessInterface, which is the base interface for both AccessCheckInterface and StaticAccessCheckInterface.

Crell’s picture

Status: Needs review » Needs work
+++ b/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
@@ -55,12 +55,12 @@ public function access(Route $route, Request $request) {
     // As we do not perform any authorization here we always return NULL to
     // indicate that other access checkers should decide if the request is
     // legit.
-    return NULL;
+    return static::DENY;
   }

This looks like a pre-existing logic error. If you have 3 checkers on a route, set to ALL, and one of them is CSRF, then you can never ever access the route. This needs to return ALLOW or KILL, but not DENY.

Otherwise this looks good to me.

dawehner’s picture

Status: Needs work » Needs review
FileSize
716 bytes
12.98 KB

Good point ... I totally think that ALLOW should be returned. In the case that CSRF is the only access checker, NULL works as TRUE in the any case, and you expect it to work like TRUE in the ALL case.

Status: Needs review » Needs work

The last submitted patch, access-2063405-21.patch, failed testing.

dawehner’s picture

What about just converting it for now and figure out the details later?

Crell’s picture

Status: Needs work » Needs review
FileSize
519 bytes
12.98 KB

I think all you need is to use the right constant name. :-)

Status: Needs review » Needs work
Issue tags: -DrupalWTF, -WSCCI

The last submitted patch, 2063405-access-checkers.patch, failed testing.

Crell’s picture

Status: Needs work » Needs review

#24: 2063405-access-checkers.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 2063405-access-checkers.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
Issue tags: +DrupalWTF, +WSCCI

#24: 2063405-access-checkers.patch queued for re-testing.

dawehner’s picture

oooh!

dawehner’s picture

#24: 2063405-access-checkers.patch queued for re-testing.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community

I grepped the code base for all occurrences of the string "AccessCheckInterface", opened the files if they were actual access check classes, and confirmed that they are using static::(ALLOW|DENY|KILL) everywhere, without exception.

Combined with the fact that tests pass: RTBC.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed c5ef1c9 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

update