Skip to content

Commit

Permalink
[TASK] Replace GeneralUtility::hmac usage in ext:fluid
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
derhansen authored and sbuerk committed Mar 4, 2024
1 parent 71d389e commit 2df65da
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -18,6 +18,7 @@
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;
Expand Down Expand Up @@ -149,7 +150,8 @@ protected function createFileDumpUrl(FileInterface $file): string
$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);
Expand Down

0 comments on commit 2df65da

Please sign in to comment.