Problem with Mail Login || Deprecation of UserAuthInterface

Created on 22 July 2024, about 2 months ago
Updated 23 August 2024, 27 days ago

Problem/Motivation

I installed Security Review together with Mail Login module. I see a WSOD at /admin/config/security-review and /admin/reports/status while /admin/reports/security-review works until you execute the checklist. Security Review is running the first time.

TypeError: Cannot assign Drupal\mail_login\AuthDecorator to property Drupal\security_review\Plugin\SecurityCheck\NamePasswords::$userAuth of type Drupal\user\UserAuthInterface in Drupal\security_review\Plugin\SecurityCheck\NamePasswords::create() (line 67 of modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php).

Steps to reproduce

Install and activate Drupal 10.3.1 with Mail Login 4.0.2 and Security Review 3.0.2

🐛 Bug report
Status

Needs work

Version

3.0

Component

Code

Created by

🇩🇪Germany d4t3r

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

Comments & Activities

  • Issue created by @d4t3r
  • Status changed to Closed: duplicate about 2 months ago
  • Status changed to Active about 2 months ago
  • 🇩🇪Germany d4t3r

    Re-opening. The patch from the related issue #3462452 seems to be the wrong way. And the wrong place. I am not sure, but I read in the error message "UserAuthInterface" instead of "UserAuthenticationInterface". Sounds wrong, deprecated.

  • 🇸🇮Slovenia LUTi

    I've managed to run Security Review with the following patch:

    diff -up modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php~ modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php
    --- modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php~	2024-07-10 19:55:58.848825234 +0200
    +++ modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php	2024-07-23 21:24:40.015774057 +0200
    @@ -14,7 +14,7 @@ use Drupal\Core\Plugin\ContainerFactoryP
     use Drupal\security_review\CheckResult;
     use Drupal\security_review\SecurityCheckBase;
     use Drupal\user\Entity\User;
    -use Drupal\user\UserAuthInterface;
    +use Drupal\user\UserAuthenticationInterface;
     use Symfony\Component\DependencyInjection\ContainerInterface;
     
     /**
    @@ -53,9 +53,9 @@ class NamePasswords extends SecurityChec
       /**
        * Drupal's user authentication service.
        *
    -   * @var \Drupal\user\UserAuthInterface
    +   * @var \Drupal\user\UserAuthenticationInterface
        */
    -  protected UserAuthInterface $userAuth;
    +  protected UserAuthenticationInterface $userAuth;
     
       /**
        * {@inheritdoc}
    @@ -97,7 +97,7 @@ class NamePasswords extends SecurityChec
         $users = User::loadMultiple($ids);
         $findings = [];
         foreach ($users as $user) {
    -      if ($this->userAuth->authenticate($user->getDisplayName(), $user->getDisplayName())) {
    +      if ($this->userAuth->authenticateAccount($this->userAuth->lookupAccount($user->getDisplayName()), $user->getDisplayName())) {
             $findings[] = $user->getDisplayName();
           }
     
    
  • 🇩🇪Germany d4t3r

    Due to the fact, that disabling Security Review shows the same error, i tried the patch. I copied it into a file and configured composer-patches to apply it.
    But the patch is faulty, e.g. @@ -14,7 +14,7 @@ use Drupal\Core\Plugin\ContainerFactoryP
    And there is a file not found, too. With my poor knowlegde I can't say if it is the non existend tilde file NamePasswords.php~ or a double path component modules/contrib/security_review/ or both.

  • 🇫🇷France erwangel

    I came to the same error while uninstalling the deprecated module (in D10.3.1) layout_builder_expose_all_field_blocks with drush pm:uninstall.

    TypeError: Cannot assign Drupal\mail_login\AuthDecorator to property Drupal\security_review\Plugin\SecurityCheck\NamePasswords::$userAuth of type Drupal\user\UserAuthInterface in Drupal\security_review\Plugin\SecurityCheck\NamePasswords::create() (line 67 of /path_to_site/web/modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php) #0 /path_to_site/web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\security_review\Plugin\SecurityCheck\NamePasswords::create()

    Then while accessing admin/config/security-review: WSOD with the following

    TypeError: Cannot assign Drupal\mail_login\AuthDecorator to property Drupal\security_review\Plugin\SecurityCheck\NamePasswords::$userAuth of type Drupal\user\UserAuthInterface in Drupal\security_review\Plugin\SecurityCheck\NamePasswords::create() (line 67 of modules/contrib/security_review/src/Plugin/SecurityCheck/NamePasswords.php).

    No problem to access admin/config/people/mail-login

  • 🇩🇪Germany d4t3r

    Found in src/Plugin/SecurityCheck/NamePasswords.php

  • Status changed to Needs work 27 days ago
  • 🇩🇪Germany d4t3r

    Mail Login 4.0.3 solved my main issue. I keep this issue open, because the deprecated code seems not to be targeted anywhere else.

Production build 0.71.5 2024