Merge conflict Gerrit cannot merge this change. It needs a rebase onto main.

Review main Ready for review

98203[TASK] Decide backend access with security voters

Matthias Vogel CR 0 V -1 Hard +616 −221 updated 11/30/26, 12:07

Commit message

BackendAccessCheck asks the rules of BackendAccessRules directly. Thus
an extension cannot add a check before the frontend accepts a backend
user. The core uses security voters for other access decisions, for
example for backend modules and tables, but not for this decision.

The new voter BackendAccessVoter decides with Scope::ACCESS on the new
subject BackendAccessRequest. The subject contains the normalized
parameters of the request. They are null when the caller does not ask
for the rules for the IP address and HTTPS. The voter asks the same
rules in the same order as before. It adds the reason of a denial to
the vote.

BackendAccessCheck builds a PrincipalToken for the backend user and
asks the access decision manager. It does not use the token storage,
because in the frontend the token storage contains the principal of
the frontend user. The reason of the first voter that denies the
access is the reason of the BackendAccessDecision. The public methods
of BackendAccessCheck do not change.

BackendUserAuthentication::isUserAllowedToLogin() reads from the
database whether the original backend user of a switched session is
still an administrator. The principal does not contain this
information. Thus the voter asks this method of the backend user
object that LegacyBackendUserRegistry knows for the principal. The
voter denies a backend principal without such an object. The reason
of this denial is the new constant
BackendAccessRules::REASON_NO_BACKEND_USER_OBJECT.

An extension can now deny the backend user in the frontend with a
voter on Scope::ACCESS and BackendAccessRequest. Such a voter cannot
grant the access when BackendAccessVoter denies it.

Behaviour change: the frontend denies a switched session when the
original backend user is not an active backend user in the database.
This is the case when the record of the original backend user:

- is deleted,
- is disabled,
- has a start time in the future,
- has an end time in the past,
- is not on the root level (pid 0), or
- does not exist.

The principal factory builds no principal for such a session. Thus the
voter denies it with the reason "The request has no authenticated
backend user." Before this change, the frontend accepted such a session
in these cases:

- [BE][adminOnly] is 0.
- [BE][adminOnly] is above 0 and the backend user of the session is an
  administrator.
- [BE][adminOnly] is above 0 and the original backend user is an
  administrator whose record is not on the root level.

FrontendBackendUserAuthentication::backendCheckLogin() makes the same
decision as the frontend middleware for a switched session.
Show more Show less

Test this change

Run a command in your clone of the TYPO3 Core. Then try what the change does and vote on Verified in Gerrit. How to review a patch

Check out patch set 1
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/03/98203/1 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/03/98203/1 && git cherry-pick FETCH_HEAD

Review

  • Code review CR 0 Needs a vote
  • Verified V -1 Blocked
    • core-ci -1 CI

Relation chain 2

  1. 98203 [TASK] Decide backend access with security voters This change

  2. 98018[TASK] Check backend access of a user in one place This change is based on it Matthias Vogel → main, 14.3 Hard +717 −19 CR 0 V 0 1 unresolved

Issues 2

Files 12

Review log 12

  1. Matthias Vogel uploaded patch set 1 11/30/26, 11:58

  2. core-ci voted on patch set 1 V -1 11/30/26, 12:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/116013