Project

General

Profile

Actions

Bug #93195

closed

cHash comparison failure on a workspace page preview

Added by Rémy DANIEL over 3 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2020-12-31
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
10
PHP Version:
7.4
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

Description of the bug

I use f:uri.action to generate a link to an Extbase plugin, with some plugin arguments.
There is not RouteEnhancer on the plugin, so a cHash is added to the generated uri.

When the target page of the link is a draft version of the page, accessing the generated uri leads to a 404 (cHash comparison failed).

How to reproduce

It is not easy to reproduce, but here is some steps.

The issue exists since TYPO3 10. I cannot reproduce it on TYPO3 9.

  1. setup ext:workspace with one draft workspace
  2. create a site with a rootpage and a working TS setup
  3. switch to the draft workspace
  4. on a page, create a TS template with this setup override:
      page.10 > 
      page.10 = FLUIDTEMPLATE
      page.10 {
        template = TEXT
        template.value = {f:uri.action(action: 'show', controller: 'Test', extensionName: 'Test', arguments: {foo: 'bar'})}
      }
  5. the page has now a live version (uid=1, t3ver_wsid=0) and a draft version (uid=2, t3ver_oid=1, t3ver_wsid=1)
  6. display the preview of the page: you see the uri generated with a cHash
  7. go to the generated url: a 404 is triggered because of a cHash comparison failure

Debugging

When building the cHash, the ID of the page is used along with other parameters in the cHash calculation .
When validating the cHash, the ID of the page found by the router is used (see \TYPO3\CMS\Frontend\Middleware\PageArgumentValidator::getRelevantParametersForCacheHashCalculation).
In most of the case, there is no reason that this page's id change, so this part of the cHash calculation/checking works well.

Now, while debugging, I found that when generating the uri, the uid of the live page is used.

But when the uri is requested and the cHash is validated, the page id is taken from $request->getAttribute('routing') (which is a PageArguments instance).
Here, the page id is the draft uid.

Because the page id are not the same, the cHash comparison could not succeed, and this will trigger a 404.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #97940: Workspace Preview Link not working (404) if the slug has been changedClosed2022-07-14

Actions
Actions

Also available in: Atom PDF