Warn if security.enable_super_user is false and UID 1 has an administrator role

Created on 5 November 2024, about 2 months ago

Problem/Motivation

Many sites are installed with the Standard install profile, creating a default Administrator role that user 1 is assigned to. As well, it's possible to set `is_admin` on any role with a config import.

What is confusing is when a site disables the Super User Access Policy, but the admin user still has admin access. This is because you need to additionally remove any administrator roles.

default.settings.php details this, though https://www.drupal.org/docs/administering-a-drupal-site/security-in-drup... was missing this until I added it a few moments ago. However, nothing stops the admin user from being granted an admin role later.

Steps to reproduce

Install Drupal with the standard profile, disable the superuser policy in default.services.yml, and clear caches. Note the admin user can still admin the site.

Proposed resolution

Add a status report check warning if the policy is disabled but in practice not taking effect due to additional roles. Personally, I'd be OK with this being an error too, but I think there is a case now where user 1 is a regular named account is being granted admin permissions.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

11.1 🔥

Component

base system

Created by

🇨🇦Canada deviantintegral

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

Comments & Activities

Production build 0.71.5 2024