Access to TFA page is denied

Created on 3 January 2025, 6 days ago

Problem/Motivation

I have a user with the needed TFA permissions to set the TFA and disable it. But for some reason, this user is not able to access the /user/{{id}}/security/tfa page to set TFA.

I tried to find out what is blocking the user access and found out that removing: _custom_access: '\Drupal\tfa\Controller\TfaLoginController::accessSelfOrAdmin' from the route allows the user to access the TFA settings page.

Looking at the accessSelfOrAdmin function I found that the outcome is as expected, access is allowed because the user is Self. So this shouldn't be the issue. But I can't find out what is.

And this is where I'm stuck now. In what way can I debug this further? Any idea what the problem could be?

πŸ› Bug report
Status

Active

Version

1.9

Component

Code

Created by

πŸ‡³πŸ‡±Netherlands zebda

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @zebda
  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    This sounds like the user does not actually have the 'setup own tfa' permission.
    Permissions in routing.yml are an AND between _custom_access and _permission

  • πŸ‡³πŸ‡±Netherlands zebda

    But when removing the _custom_access allows the user to access the page, I think this proves that the permissions are set. Because the only thing that is checked for the route is the permission 'setup own tfa'. Are am I wrong?

  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    think this proves that the permissions are set.

    Good point. That should indeed imply that the permission is set as long as you are on 8.x-1.9 (if your on 8.x1.x-dev we recently changed operations so the access controller performs all the checks πŸ› Admin cannot disable TFA for a user Active ).

    I'm a bit of a loss here. If you say you see accessSelfOrAdmin returns that access is permitted yet core is refusing the access I wonder if there is some issue upstream or in side-stream.

    I haven't explicitly attempted to reproduce this this today, however I'm in that page often as test users for dev work and never seen a problem.

    What version of core? Any other modules installed (especially those that apply core new Access Policy API as this changes how core processes permissions)?

  • πŸ‡ΊπŸ‡ΈUnited States cmlara

    Minor title adjustment.

  • πŸ‡³πŸ‡±Netherlands zebda

    Yes, my best bet is that another module in combination with TFA is the problem. But I can't see what is doing this. I'm using contributed module field_permissions. And have some custom modules, using AccessResult one specifically focussing on user pages. But turning off this module doesn't solve the problem. Is there a better way to debug than just turning modules off one by one?

    P.s. I'm on 1.9, also tried the dev version but it didn't make any difference.

  • πŸ‡³πŸ‡±Netherlands zebda

    Found it. I finally did went for disabling the modules one by one. And ended up with an access handler in one of my custom modules. Don't understand why it blocked access to the tfa pages but I fixed it.

  • πŸ‡³πŸ‡±Netherlands zebda
Production build 0.71.5 2024