From 2df65da0dcbd378f7a43efbd93e1e57de6221c3d Mon Sep 17 00:00:00 2001 From: Torben Hansen <derhansen@gmail.com> Date: Sat, 2 Mar 2024 13:46:16 +0100 Subject: [PATCH] [TASK] Replace GeneralUtility::hmac usage in ext:fluid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With #102761, the new `HashService` has been introduced to ensure that HMAC generation will always use an additional secret. As a follow-up patch, `GeneralUtility::hmac` will be deprecated when all usages in the core have been replaced with the new `HashService`. With this change, usages of `GeneralUtility::hmac` in ext:fluid are replaced by the new HashService. Resolves: #103246 Releases: main Change-Id: I7090d13590dc0c5d871eadf73aa9c1278cda1f88 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83178 Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> Reviewed-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../sysext/fluid/Classes/ViewHelpers/Link/FileViewHelper.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Link/FileViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Link/FileViewHelper.php index 259db618a812..012bc67395d3 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Link/FileViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Link/FileViewHelper.php @@ -18,6 +18,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Fluid\ViewHelpers\Link; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\Crypto\HashService; use TYPO3\CMS\Core\Resource\File; use TYPO3\CMS\Core\Resource\FileInterface; use TYPO3\CMS\Core\Resource\FileReference; @@ -149,7 +150,8 @@ final class FileViewHelper extends AbstractTagBasedViewHelper $parameters['fn'] = $filename; } - $parameters['token'] = GeneralUtility::hmac(implode('|', $parameters), 'resourceStorageDumpFile'); + $hashService = GeneralUtility::makeInstance(HashService::class); + $parameters['token'] = $hashService->hmac(implode('|', $parameters), 'resourceStorageDumpFile'); return GeneralUtility::locationHeaderUrl(PathUtility::getAbsoluteWebPath(Environment::getPublicPath() . '/index.php')) . '?' . http_build_query($parameters, '', '&', PHP_QUERY_RFC3986); -- GitLab