Issue Bug Closed

#107414Regression in GeneralUtility::sanitizeLocalUrl

Thomas Hohn 09/09/25, 11:19 updated 12/02/25, 13:04

Description

With TYPO 12.4.37 and and 13.4.18 – searching for items with spaces and edit + close results in that the user
ends up on the root page instead of staying in the corresponding module.
Example:

Go to List module and choose root page
Search for page title with space in it
Edit page
press "Close"
You end up in on the root page instead of "staying" in the module like in 12.4.36

The “close” button url looks like and seems properly encoded

https://test.xxx/typo3/record/edit?token=a4c681c93582d55aab0879370bf29b82beb6407c&edit%5Bpages%5D%5B499%5D=edit&returnUrl=/typo3/module/web/list?token%3Dedaf7be5647d18769812b50e24b55c2169fc5e9f%26id%3D1%26table%3D%26searchTerm%3DLog%2520ind%26pointer%3D1#

the return url looks identical in 12.4.36 and 12.4.37.

Since the check operates on the decoded url it will always fail if the parameters contains
spaces:

 $decodedUrl = rawurldecode($url);
 if (strpbrk($decodedUrl, " \n\r\t\v\x00") !== false) {
   static::getLogger()->notice('URL "{url}" contains unexpected whitespace and was denied as local url.', ['url' => $url]);
   return '';
 }

I’m uncertain if the check should be on the original url instead of the decoded – newer the less the bug prevents us from upgrading to 12.4.37 since it breaks the edit functionality for standard backend core modules and own backend modules.

Reviews 3