Issue Bug Closed

#108948TemporaryPermissionMutationService::removeSysRedirectPermission() corrupts groupData

Wolfgang Klinger 02/11/26, 18:36 updated 03/31/26, 08:11

Description

Description

The newly introduced TemporaryPermissionMutationService in commit:6a16c5ac313 has a bug in removeSysRedirectPermission() that corrupts $GLOBALS['BE_USER']->groupData['tables_modify'] for non-admin backend users.

Related issues: #95272, #91792

Steps to Reproduce

Log in as a non-admin backend user with pages and tt_content table modify permissions (but not sys_redirect).
Edit a page slug that has child pages (triggers nested slug updates).
Save the page.

Expected Behavior

Child page slugs are updated correctly. The user’s tables_modify permission is correctly restored to pages,tt_content after the redirect is created.

Actual Behavior

The user’s tables_modify is set to the literal string tables_modify instead of the original permission value. Child page slug updates fail silently because the user no longer has pages in their permission list.

Root Cause

removeTableModify() passes the key name 'tables_modify' to removeSysRedirectPermission(), which explodes the key name directly instead of reading the actual value from groupData.

The faulty removeSysRedirectPermission():

// removeTableModify() passes the KEY NAME 'tables_modify':
public function removeTableModify(): void
{
    if ($this->containsSysRedirectPermission('tables_modify')) {
        $GLOBALS['BE_USER']->groupData['tables_modify'] = $this->removeSysRedirectPermission('tables_modify');
    }
}

// removeSysRedirectPermission() explodes the parameter directly:
private function removeSysRedirectPermission(string $permissionString): string
{
    $permissions = GeneralUtility::trimExplode(',', $permissionString, true);
    //                                              ^^^^^^^^^^^^^^^^^ = 'tables_modify', NOT the actual value
    $permissions = array_diff($permissions, ['sys_redirect']);
    return implode(',', array_unique($permissions));
    // Returns 'tables_modify' — the original permissions are lost
}

Compare with the working addSysRedirectPermission() — same caller pattern, but it correctly dereferences the key:

private function addSysRedirectPermission(string $groupData): string
{
    $permissions = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->groupData[$groupData], true);
    //                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ reads actual value
    $permissions[] = 'sys_redirect';
    return implode(',', array_unique($permissions));
}

So when removeTableModify() calls $this->removeSysRedirectPermission('tables_modify'), it explodes the string 'tables_modify' into ['tables_modify'], removes 'sys_redirect' (not found, no-op), and returns the string 'tables_modify'.

Result: $GLOBALS['BE_USER']->groupData['tables_modify'] = 'tables_modify' — the actual permissions are gone.

The same bug affects removeTableSelect() / tables_select.

Fix

Make removeSysRedirectPermission() consistent with addSysRedirectPermission() by reading from $GLOBALS['BE_USER']->groupData:

private function removeSysRedirectPermission(string $groupData): string
{
    $permissions = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->groupData[$groupData], true);
    $permissions = array_diff($permissions, ['sys_redirect']);
    return implode(',', array_unique($permissions));
}

Affected Versions

Impact

  • Non-admin users editing page slugs with child pages: child slugs are not updated
  • Any extension using DataHandler hooks after the nested slug update sees corrupted permissions
  • The corruption persists for the remainder of the request

Reviews 2