Merge conflict

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

Review main Work in progress

98328[TASK] Add a live view kind of preview token

Matthias Vogel CR 0 V 0 Hard +771 −73 updated 12/04/26, 10:25

Commit message

This adds an internal function: a second kind of preview token, the
live view token. The classes are marked @internal. The later patch
"[BUGFIX] Use preview tokens in the frames of the workspace preview"
(C5b) uses it. There, the PreviewController of the workspaces
extension issues a live view token for the live frame next to the
workspace preview. Thus the backend user can compare the workspace
with the live workspace on every site domain.

A preview token makes its backend user the backend user of the
request. The live frame must show the page as a visitor sees it. A
backend user who may only work in a workspace has no access to the
live workspace. Thus a preview token cannot show the live page to
this backend user.

A live view token shows the page in the live workspace, at the
current time and without a frontend login:

- PreviewTokenKind tells the two kinds apart. A live view token
  contains the backend user in the claim "scp" instead of "sub", see
  PreviewTokenKind::getBackendUserClaim(). Thus no code that reads
  "sub" takes the token for a login. PreviewTokenClaims denies a
  token with both claims, and a live view token with a simulation
  that asks for more than the live view.
- PreviewTokenIssuer::issueLiveView() issues the token. The backend
  user needs the right to show the page. The token is valid on every
  site, in the languages that are enabled for visitors, see
  PreviewHostsResolver::resolveForLiveView().
- A renewal keeps the kind of the token. As for each renewal, the
  fresh token simulates no frontend login and no frontend user
  groups. A live view token has neither of them, so nothing changes
  for it. The renewal of a live view token needs no right to show
  the page of the frame, because the live frame follows the links of
  the page as a visitor does. PageRule only checks that the frame
  names a page id. WorkspaceOfTokenRule allows the renewal in each
  workspace.
- The site builds no backend user for a live view token. The rules
  of PreviewRequestCheck apply with the hosts of every site: the
  frame, the backend session, the host and the site. The rights of
  a backend user do not apply. PreviewSimulator shows the page
  without the frontend login of the request.

A live view token cannot open more than a visitor sees, also after a
renewal for any page id. The request has no backend user, the live
workspace, the current time and the frontend user groups of a
visitor. Tests prove it: a hidden page gives 404, a page for a
frontend user group gives 403, also with the frontend login of a
member, and hidden content stays out of the page.

The tests of "[BUGFIX] Keep the preview token in links, forms and
redirects" and "[BUGFIX] Keep the preview token in navigations that
scripts start" now pass the kind PreviewTokenKind::Preview. A new
test proves that the links to each site and the frame keep a live
view token.

This patch needs the renewal of "[BUGFIX] Renew the preview token of
the frame" and builds on it. It is chained on top of "[BUGFIX] Follow
the page of the preview frame in the backend". Merge the patches
below it in the chain first, then this patch, then "[BUGFIX] Use
preview tokens in the frames of the workspace preview".
Show more Show less
Resolves: #TBD
Related: #110664
Releases: main, 14.3
Change-Id: I885ea21558b0d645de84941cf876021b064ab29f

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

Review

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

Relation chain 16

  1. 98329[BUGFIX] Use preview tokens in the frames of the workspace preview Based on this change Matthias Vogel → main, 14.3 Hard +580 −55 CR 0 V 0 Work in progress Merge conflict
  2. 98328 [TASK] Add a live view kind of preview token This change

  3. 98327[BUGFIX] Follow the page of the preview frame in the backend This change is based on it Matthias Vogel → main, 14.3 Expert +1225 −114 CR 0 V -1 Work in progress Merge conflict
  4. 98326[BUGFIX] Keep the preview token in navigations that scripts start This change is based on it Matthias Vogel → main, 14.3 Hard +922 −4 CR 0 V 0 Work in progress Merge conflict
  5. 98325[BUGFIX] Keep the preview token in links, forms and redirects This change is based on it Matthias Vogel → main, 14.3 Hard +828 −38 CR 0 V 0 Work in progress Merge conflict
  6. 98324[BUGFIX] Renew the preview token of the frame This change is based on it Matthias Vogel → main, 14.3 Expert +1634 −63 CR 0 V 0 Work in progress Merge conflict
  7. 98323[TASK] Add one frame component for the preview frames of the backend This change is based on it Matthias Vogel → main, 14.3 Hard +544 −68 CR 0 V 0 Work in progress Merge conflict
  8. 97235[BUGFIX] Preview hidden pages across site domains This change is based on it Matthias Vogel → main, 14.3 Hard +467 −10 CR 0 V 0 Work in progress Merge conflict 19 unresolved
  9. 98322[TASK] Accept preview tokens in the frontend This change is based on it Matthias Vogel → main, 14.3 Expert +1994 −4 CR 0 V 0 Work in progress Merge conflict
  10. 98321[TASK] Issue preview tokens in the backend This change is based on it Matthias Vogel → main, 14.3 Hard +880 −1 CR 0 V 0 Work in progress Merge conflict
  11. 98320[TASK] Check where a request with a preview token comes from This change is based on it Matthias Vogel → main, 14.3 Hard +934 −1 CR 0 V 0 Work in progress Merge conflict
  12. 98319[BUGFIX] Handle query parameters of links in one place This change is based on it Matthias Vogel → main, 14.3 Hard +435 −20 CR 0 V 0 Work in progress
  13. 98318[TASK] Resolve the sites and hosts a backend user may preview This change is based on it Matthias Vogel → main, 14.3 Hard +700 −0 CR 0 V 0 Work in progress
  14. 98317[TASK] Sign and verify preview tokens This change is based on it Matthias Vogel → main, 14.3 Hard +625 −0 CR 0 V -1 Work in progress Merge conflict
  15. 98316[TASK] Add typed claims for preview tokens This change is based on it Matthias Vogel → main, 14.3 Hard +530 −0 CR 0 V -1 Work in progress
  16. 98315[TASK] Add a read-only backend user for one workspace This change is based on it Matthias Vogel → main, 14.3 Expert +1719 −2 CR 0 V 0 Work in progress

    The chain has patch set 1 of 2, the changes above it need a rebase.

Issues 1

Files 29

Show 9 more files Show less

Review log 23

  1. Matthias Vogel uploaded patch set 1 12/04/26, 09:02

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

  3. Matthias Vogel wrote 12/04/26, 10:25

    Topic set to cross-domain-preview