Review main Work in progress

97967[FEATURE] Authenticate backend requests with access tokens

Benni Mack CR 0 V 0 Nightmare +2597 −11 updated 11/28/26, 19:09

Commit message

Clients without a browser, such as integrations, deployment pipelines
or AI clients, have no proper way to authenticate: they borrow a
password or a session of an editor.

Backend users now get access tokens. A token is sent as "Authorization:
Bearer t3p_..." and accepted only on backend routes that declare
'authentication' => ['token'], so backend modules never receive a
request without session. Such a route evaluates no session cookie and
leaves it untouched, so a request cannot act with the session of a
logged-in browser; ['session', 'token'] accepts both. A request with a
token is stateless: no session is created, no cookie is sent and no
request token is needed. A malformed, unknown, revoked or expired
token, or one of a disabled user, is answered with 401 and counts
towards the login rate limit, which never holds up a valid token.
Multi-factor authentication is not asked for a token.

Only the SHA-256 hash of a token is stored in the new table sys_token,
with its last four characters as hint. The prefix t3p_ and a checksum
let secret scanners detect leaked tokens and drop mistyped ones
without a database query. Every token has at least one scope and
expires at the latest after
$GLOBALS['TYPO3_CONF_VARS']['BE']['accessTokenMaxLifetime'] days, 90
by default. The commands token:create, token:list and token:revoke
manage tokens.

The scopes content:read and content:write cap a token request. The
scopes are stored as AccessTokenContext on the PrincipalToken, as they
belong to the credential and not to the user. The new ScopeVoter never
grants: it abstains on decisions a scope covers, so that the other
voters decide as for the user, and denies all others, role checks and
backend modules included. BackendUserAuthentication::check() and the
other legacy checks are capped the same way; a check() the voters have
no subject for yet, such as of modules or tables without TCA, is
denied. Page permissions are limited to those the scopes cover, file
permissions are denied, as no scope covers files yet.

Administrators and the command line user get no token: isAdmin()
grants administrators everything before any scope is asked, and the
command line user never acts over HTTP.

The PHP API is internal. The backend user interface, service accounts
and tokens for reactions follow separately.
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 9
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/67/97967/9 && git checkout FETCH_HEAD
Cherry-pick onto main
git fetch https://review.typo3.org/Packages/TYPO3.CMS refs/changes/67/97967/9 && git cherry-pick FETCH_HEAD

Review

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

Merge conflicts 37

Show 32 more changes Show less

Issues 2

Files 33

Show 13 more files Show less

Review log 918

  1. Benni Mack uploaded patch set 1 11/24/26, 17:29

  2. core-ci voted on patch set 1 V +1 11/24/26, 17:39 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115311

  3. Benni Mack uploaded patch set 2 V +1 11/24/26, 18:28

  4. core-ci voted on patch set 2 V +1 11/24/26, 18:35 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115317

  5. Benni Mack uploaded patch set 3 V +1 11/25/26, 06:45

  6. core-ci voted on patch set 3 V +1 11/25/26, 06:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115356

  7. Oli Bartsch uploaded patch set 4 V +1 11/26/26, 21:15

  8. core-ci voted on patch set 4 V -1 11/26/26, 21:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115628

  9. Oli Bartsch uploaded patch set 5 V -1 11/26/26, 21:39

  10. core-ci voted on patch set 5 V +1 11/26/26, 21:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115638

  11. Benni Mack uploaded patch set 6 V +1 11/27/26, 14:44

  12. core-ci voted on patch set 6 V +1 11/27/26, 15:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115743

  13. Benni Mack uploaded patch set 7 V +1 11/28/26, 14:03

  14. core-ci voted on patch set 7 V +1 11/28/26, 14:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115848

  15. Benni Mack uploaded patch set 8 V +1 11/28/26, 15:16

  16. core-ci voted on patch set 8 V +1 11/28/26, 15:27 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115863

  17. Benni Mack uploaded patch set 9 V +1 11/28/26, 19:02

  18. core-ci voted on patch set 9 V +1 11/28/26, 19:09 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/115884