Merge conflict
Gerrit cannot merge this change. It needs a rebase onto main.
98328[TASK] Add a live view kind of preview token
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
- 98329[BUGFIX] Use preview tokens in the frames of the workspace preview
-
98328 [TASK] Add a live view kind of preview token This change
- 98327[BUGFIX] Follow the page of the preview frame in the backend
- 98326[BUGFIX] Keep the preview token in navigations that scripts start
- 98325[BUGFIX] Keep the preview token in links, forms and redirects
- 98324[BUGFIX] Renew the preview token of the frame
- 98323[TASK] Add one frame component for the preview frames of the backend
- 97235[BUGFIX] Preview hidden pages across site domains
- 98322[TASK] Accept preview tokens in the frontend
- 98321[TASK] Issue preview tokens in the backend
- 98320[TASK] Check where a request with a preview token comes from
- 98319[BUGFIX] Handle query parameters of links in one place
- 98318[TASK] Resolve the sites and hosts a backend user may preview
- 98317[TASK] Sign and verify preview tokens
- 98316[TASK] Add typed claims for preview tokens
-
98315[TASK] Add a read-only backend user for one workspace
The chain has patch set 1 of 2, the changes above it need a rebase.
Issues 1
Files 29
- typo3/sysext/backend/Classes/Preview/Rule/PageRule.php+9 −0
- typo3/sysext/backend/Classes/Preview/Rule/PreviewTokenIssueSubject.php+3 −1
- typo3/sysext/backend/Classes/Preview/Rule/WorkspaceOfTokenRule.php+7 −0
- typo3/sysext/backend/Classes/Preview/PreviewTokenIssuer.php+39 −16
- typo3/sysext/backend/Tests/Functional/Preview/PreviewTokenIssuerTest.php+161 −5
- typo3/sysext/backend/Tests/Unit/Preview/PreviewFrameFactoryTest.php+2 −1
- typo3/sysext/core/Classes/Preview/PreviewHostsResolver.php+43 −11
- typo3/sysext/core/Classes/Preview/PreviewSimulation.php+15 −0
- typo3/sysext/core/Classes/Preview/PreviewToken.php+3 −1
- typo3/sysext/core/Classes/Preview/PreviewTokenClaims.php+28 −3
- typo3/sysext/core/Classes/Preview/PreviewTokenKind.phpnew+52 −0
- typo3/sysext/core/Classes/Preview/PreviewTokenService.php+13 −7
- typo3/sysext/core/Tests/Functional/Preview/PreviewHostsResolverTest.php+1 −1
- typo3/sysext/core/Tests/Unit/Preview/PreviewTokenClaimsTest.php+21 −0
- typo3/sysext/core/Tests/Unit/Preview/PreviewTokenKeeperTest.php+2 −1
- typo3/sysext/core/Tests/Unit/Preview/PreviewTokenServiceTest.php+62 −2
- typo3/sysext/fluid/Tests/Functional/ViewHelpers/FormViewHelperTest.php+2 −1
- typo3/sysext/frontend/Classes/Middleware/PreviewSimulator.php+18 −0
- typo3/sysext/frontend/Classes/Middleware/PreviewTokenAuthenticator.php+39 −5
- typo3/sysext/frontend/Classes/Middleware/PreviewTokenPagePermissions.php+5 −0
- typo3/sysext/frontend/Tests/Functional/Middleware/PreviewNavigationScriptTest.php+2 −1
- typo3/sysext/frontend/Tests/Functional/Middleware/PreviewTokenAuthenticatorCacheHashTest.php+2 −1
- typo3/sysext/frontend/Tests/Functional/Middleware/PreviewTokenAuthenticatorContentSecurityPolicyTest.php+2 −1
- typo3/sysext/frontend/Tests/Functional/Middleware/PreviewTokenAuthenticatorTest.php+230 −10
- typo3/sysext/frontend/Tests/Functional/Preview/Rule/ActiveBackendSessionRuleTest.php+2 −1
- typo3/sysext/frontend/Tests/Unit/Preview/Rule/HostOfPreviewRuleTest.php+2 −1
- typo3/sysext/frontend/Tests/Unit/Preview/Rule/RequestFromFrameRuleTest.php+2 −1
- typo3/sysext/frontend/Tests/Unit/Preview/Rule/SiteOfPreviewRuleTest.php+2 −1
- typo3/sysext/frontend/Tests/Unit/Preview/PreviewRequestCheckTest.php+2 −1
Show 9 more files Show less
Review log 23
-
Matthias Vogel uploaded patch set 1 12/04/26, 09:02
-
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
-
Matthias Vogel wrote 12/04/26, 10:25
Topic set to cross-domain-preview