Problem with Mail Login

Created on 22 July 2024, 12 months 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

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany drupalbubb

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

Comments & Activities

  • Issue created by @drupalbubb
  • Status changed to Closed: duplicate 12 months ago
  • Status changed to Active 12 months ago
  • 🇩🇪Germany drupalbubb

    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 drupalbubb

    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 drupalbubb

    Found in src/Plugin/SecurityCheck/NamePasswords.php

  • Status changed to Needs work 11 months ago
  • 🇩🇪Germany drupalbubb

    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.

  • 🇺🇸United States smustgrave

    Been loosely following but was this a bug in mail auth?

  • 🇩🇪Germany drupalbubb

    @smustgrave, please have a look at src/Plugin/SecurityCheck/NamePasswords.php if the use of UserAuthInterface is deprecated (like my coding skills, haha).
    If yes, we should have a new issue, this one was originaly about Mail Login module. And have a look at #4.
    After that close this one. Thanks.

  • 🇫🇷France erwangel

    No more have had this problem since 3.0.3

  • 🇺🇸United States smustgrave

    Will have to start a new branch. UserAuthInterface doesn't appear to be deprecated yet but says it could be in D11 but the new service userAuthenticationInterface was only added in 10.3 so that change could break those running on lower then 10.3

    • smustgrave committed d6e693e6 on 3.1.x
      Issue #3463067 by drupalbubb, erwangel, smustgrave, LUTi: Problem with...
  • 🇺🇸United States smustgrave

    Started a new branch, will try and plan a release in the next week or so.

  • Status changed to Fixed 8 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024