Skip to content

Do not let an admin shut themselves out of the admin panel - #1126

Open
KrzysztofPajak wants to merge 1 commit into
developfrom
fix/admin-self-lockout
Open

KrzysztofPajak wants to merge 1 commit into
developfrom
fix/admin-self-lockout

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

Type: bugfix

Issue

An admin could shut themselves (and everyone in their group) out of the admin panel with an ordinary save:

  • On Configuration > Permissions, saving with the own group's boxes unchecked removed AccessAdminPanel and ManageACL from the group, so nobody left could open the panel or give them back.
  • In Settings > General common, an allowed IP addresses for the admin area list without the address the admin works from shut them out at the next request (a typo is enough).

Solution

  • The permission page refuses a save that leaves the saving admin without AccessAdminPanel or ManageACL through any of their active groups. Nothing is written, and a message explains why.
  • The general settings keep the old IP list when the new one leaves out the current address (the same RemoteIpAddress the admin filter checks), with a message; the other settings of the page are saved as usual. A list that includes the address, or an empty list, is saved as before.

New resources Admin.Configuration.Permissions.CantRemoveOwnAccess and Admin.Settings.GeneralCommon.AdminAreaAllowedIpAddresses.WithoutOwn in DefaultLanguage.xml and Upgrade/en_250.xml.

Breaking changes

None. Behind a proxy without forwarded headers the address checked is the proxy's, as it already was for the admin filter.

Testing

  1. On Configuration > Permissions, uncheck every box of Administrators and save: the save is refused with a message, and the admin panel still opens.
  2. In Settings > General common, set the allowed IP addresses to 10.9.8.7 and save: the list is not changed, a message names your address, the admin panel still opens.
  3. Set the list to your address (for example ::1, 127.0.0.1) and save: it is saved. Clear it again.

PermissionControllerTests covers the refused saves and a save that keeps the own access.

Saving the permission page with the admin's own groups unchecked took away the admin panel and the
permission page from everyone who could give them back, and an allowed IP list for the admin area
without the address the admin saves from shut them out at the next request. The permission page now
refuses a save that leaves the saving admin without the admin panel or the permissions, and the
general settings keep the old IP list, with a message, when the new one leaves out the admin's
address; the other settings are still saved.
Copilot AI balanced review requested due to automatic review settings November 26, 2026 19:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants