Commit 57734b33 authored by Benni Mack's avatar Benni Mack Committed by Christian Kuhn
Browse files

[!!!][TASK] Remove FileDumpEIDHook + interface

The hook has been replaced with the PSR-14 event
"TYPO3\CMS\Core\Resource\Event\ModifyFileDumpEvent"
and is thus removed.

Resolves: #96117
Related: #95080
Releases: master
Change-Id: I0ff076381e1629028a2ca236b23121dfdffdb05c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72337

Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent ea710274
......@@ -23,11 +23,9 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
use TYPO3\CMS\Core\Resource\Event\ModifyFileDumpEvent;
use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
use TYPO3\CMS\Core\Resource\File;
use TYPO3\CMS\Core\Resource\FileInterface;
use TYPO3\CMS\Core\Resource\FileReference;
use TYPO3\CMS\Core\Resource\Hook\FileDumpEIDHookInterface;
use TYPO3\CMS\Core\Resource\ProcessedFile;
use TYPO3\CMS\Core\Resource\ProcessedFileRepository;
use TYPO3\CMS\Core\Resource\ResourceFactory;
......@@ -60,7 +58,6 @@ class FileDumpController
* @return ResponseInterface
* @throws \InvalidArgumentException
* @throws \RuntimeException
* @throws FileDoesNotExistException
* @throws \UnexpectedValueException
*/
public function dumpAction(ServerRequestInterface $request): ResponseInterface
......@@ -75,26 +72,6 @@ class FileDumpController
return $this->responseFactory->createResponse(404);
}
if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'])) {
trigger_error(
'The hook $TYPO3_CONF_VARS[SC_OPTIONS][FileDumpEID.php][checkFileAccess] is deprecated and will stop working in TYPO3 v12.0. Use the ModifyFileDumpEvent instead.',
E_USER_DEPRECATED
);
}
// Hook: allow some other process to do some security/access checks. Hook should return 403 response if access is rejected, void otherwise
// @deprecated: will be removed in TYPO3 v12.0.
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess'] ?? [] as $className) {
$hookObject = GeneralUtility::makeInstance($className);
if (!$hookObject instanceof FileDumpEIDHookInterface) {
throw new \UnexpectedValueException($className . ' must implement interface ' . FileDumpEIDHookInterface::class, 1394442417);
}
$response = $hookObject->checkFileAccess($file);
if ($response instanceof ResponseInterface) {
return $response;
}
}
// Allow some other process to do some security/access checks.
// Event Listeners should return a 403 response if access is rejected
$event = new ModifyFileDumpEvent($file, $request);
......
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\Resource\Hook;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Resource\ResourceInterface;
/**
* Interface for FileDumpEID Hook to perform some custom security/access checks
* when accessing file thought FileDumpEID
* @deprecated since TYPO3 v11 LTS, will be removed in TYPO3 v12.0. Use the PSR-14-based ModifyFileDumpEvent instead.
*/
interface FileDumpEIDHookInterface
{
/**
* Perform custom security/access when accessing file
* Method should issue 403 if access is rejected
* or 401 if authentication is required via an authorized HTTP authorization scheme.
* A 401 header must be accompanied by a www-authenticate header!
*
* @param \TYPO3\CMS\Core\Resource\ResourceInterface $file
* @return ResponseInterface|null
*/
public function checkFileAccess(ResourceInterface $file);
}
......@@ -18,7 +18,7 @@ The following PHP classes that have previously been marked as deprecated for v11
The following PHP interfaces that have previously been marked as deprecated for v11 and were now removed:
- :php:`\Full\Class\Name`
- :php:`\TYPO3\CMS\Core\Resource\Hook\FileDumpEIDHookInterface`
The following PHP class aliases that have previously been marked as deprecated for v11 and were now removed:
......@@ -82,7 +82,7 @@ The following global variables have been removed:
The following hooks have been removed:
- :php:`$GLOBALS['TYPO3_CONF_VARS']['KEY']['subKey']`
- :php:`$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['FileDumpEID.php']['checkFileAccess']`
The following signals have been removed:
......
......@@ -510,6 +510,7 @@ return [
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'FileDumpEID.php\'][\'checkFileAccess\']' => [
'restFiles' => [
'Deprecation-95080-FileDumpCheckFileAccessHook.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'$GLOBALS[\'TYPO3_CONF_VARS\'][\'SC_OPTIONS\'][\'t3lib/class.t3lib_extfilefunc.php\'][\'processData\']' => [
......
......@@ -1799,6 +1799,7 @@ return [
'TYPO3\CMS\Core\Resource\Hook\FileDumpEIDHookInterface' => [
'restFiles' => [
'Deprecation-95080-FileDumpCheckFileAccessHook.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'TYPO3\CMS\Core\Utility\File\ExtendedFileUtilityProcessDataHookInterface' => [
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment