Review main Ready for review Quiet

96561[TASK] Initialize stateless backend users from a principal

Oli Bartsch CR 0 V 0 Hard +744 −0 updated 10/28/26, 22:11

Commit message

Requests without a session, such as token based APIs, need the backend
user of an authenticated principal, set up as for a backend login but
stateless: no session is persisted, no cookie is set, and neither the
user settings nor the workspace are written back to the user record.
sys_log entries and record changes are still written as usual.

The internal StatelessBackendUserInitializer looks up the user again,
applies the login rules of the backend and makes the user the backend
user of the given backend request. It resolves groups, TSconfig,
mounts and user settings, with TSconfig conditions evaluated in the
requested workspace. The workspace is always given by the channel,
the stored workspace of the user is never used, and a workspace the
user has no access to is refused. Session data, such as flash
messages, form protection tokens or module data, is kept in an
in-memory session. A principal whose role no longer matches the user,
or an impersonated principal, is refused.

A channel runs within a backend request, as a middleware before the
backend authentication or as a handler behind it, and publishes the
request in $GLOBALS['TYPO3_REQUEST'] for the file storages.

File storages with a previous user's file mounts, the hidden files
setting and the runtime cache are reset before every build, and a
failed build leaves no user behind. The reset is defence in depth
only: one process still serves one principal, as singletons and
static state, e.g. of the DataHandler, are not reset. Whether a
channel accepts a principal at all, for example an administrator,
stays the decision of the channel.

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 7
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/61/96561/7 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/61/96561/7 && git cherry-pick FETCH_HEAD

Review

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

Issues 2

Files 5

Review log 1119

  1. Oli Bartsch uploaded patch set 1 10/09/26, 13:00

  2. core-ci voted on patch set 1 V +1 10/09/26, 13:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110604

  3. Oli Bartsch uploaded patch set 2 V +1 10/09/26, 15:21

  4. core-ci voted on patch set 2 V +1 10/09/26, 15:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110618

  5. Oli Bartsch rebased onto patch set 3 V +1 10/09/26, 20:49

  6. core-ci voted on patch set 3 V +1 10/09/26, 21:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110722

  7. Simon Schaufelberger commented on patch set 3 10/10/26, 11:44

    Benni is currently working on the auth stuff. I guess he should be aware of your changes here
  8. Oli Bartsch uploaded patch set 4 V +1 10/12/26, 12:32

  9. core-ci voted on patch set 4 V +1 10/12/26, 12:50 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110908

  10. Oli Bartsch rebased onto patch set 5 V +1 10/12/26, 19:57

  11. core-ci voted on patch set 5 V -1 10/12/26, 20:25 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110944

  12. Oli Bartsch commented on patch set 5 10/13/26, 07:25

    Reply

    Please check relation chain.
  13. core-ci voted on patch set 5 V +1 10/13/26, 07:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/110944

  14. Benni Mack commented on patch set 5 10/28/26, 09:38

    is this feature rather a "StatelessBackendUserAuthentication" or "Sessionless" or "CookielessBackendUserAuthentiaction" object?
  15. Oli Bartsch uploaded patch set 6 V +1 10/28/26, 13:39

  16. core-ci voted on patch set 6 V +1 10/28/26, 13:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112714

  17. Oli Bartsch uploaded patch set 7 V +1 10/28/26, 21:57

  18. Oli Bartsch commented on patch set 6 10/28/26, 21:57

    Reply

    Done
  19. core-ci voted on patch set 7 V +1 10/28/26, 22:11 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/112760