Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[!!!][SECURITY] Deny direct FAL commands for form definitions
Before this change, form definitions have been persisted in regular `.yaml` files. In order to make the meaning and purpose of those files more explicit, the new file ending `.form.yaml` is introduced. Invocations of the file abstraction layer API for those form files have to be allowed explicitly by granting commands individually using `FilePersistenceSlot::allowInvocation`. New form definitions are created with the new file ending per default. An upgrade wizard renames existing form definitions that are stored in according storage folders (`allowedFileMounts`). In addition references in FlexForm of content elements are adjusted to the new file names as well - in case a form definition has been referenced before. The file list user interface disabled according direct actions for `.form.yaml` files or redirects those to the according form module. Using just `.yaml` instead of `.form.yaml` from site packages is deprecated. Using just `.yaml` instead of `.form.yaml` from file storages is not allowed anymore. Resolves: #84910 Releases: master, 8.7 Security-Commit: e4680db22c680b489545679f118f3242c2929708 Security-Bulletin: TYPO3-CORE-SA-2018-003 Change-Id: I196327d968cbd53bcc623d050d5b3b8742937996 Reviewed-on: https://review.typo3.org/57554 Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Tested-by: Oliver Hader <oliver.hader@typo3.org>
- Loading branch information
1 parent
31e417f
commit 769b628
Showing
20 changed files
with
1,280 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ion/Changelog/8.7.x/Important-84910-DenyDirectFALCommandsForFormDefinitions.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
.. include:: ../../Includes.txt | ||
|
||
================================================================= | ||
Important: #84910 - Deny direct FAL commands for form definitions | ||
================================================================= | ||
|
||
In order to control settings in user provided form definitions files and only | ||
allow manipulations by using the backend form editor (or direct file access | ||
using e.g. SFTP) form file extensions have been changed form simple `.yaml` | ||
to more specific `.form.yaml`. | ||
|
||
Direct file commands by using either the backend file list module or implemented | ||
invocations of the file abstraction layer (FAL) API are denied per default and | ||
have to allowed explicitly for the following commands for files ending with the | ||
new file suffix `.form.yaml`: | ||
|
||
* plain command invocations | ||
+ create (creating new, empty file having `.form.yaml` suffix) | ||
+ rename (renaming to file having `.form.yaml` suffix) | ||
+ replace (replacing an existing file having `.form.yaml` suffix) | ||
+ move (moving to different file having `.form.yaml` suffix) | ||
* command and content invocations - content signature required | ||
+ add (uploading new file having `.form.yaml` suffix) | ||
+ setContents (changing contents of file having `.form.yaml` suffix) | ||
|
||
In order to grant those commands, `\TYPO3\CMS\Form\Slot\FilePersistenceSlot` | ||
has been introduced (singleton instance). | ||
|
||
.. code-block:: php | ||
// Allowing content modifications on a $file object with | ||
// given $newContent information prior to executing the command | ||
$slot = GeneralUtility::makeInstance(FilePersistenceSlot::class); | ||
$slot->allowInvocation( | ||
FilePersistenceSlot::COMMAND_FILE_SET_CONTENTS, | ||
$file->getCombinedIdentifier(), | ||
$this->filePersistenceSlot->getContentSignature($newContent) | ||
); | ||
$file->setContents($newContent); | ||
In contrast to *plain command invocations*, those having *content invocations* | ||
(`add` and `setContents`, see list of commands above) require a content signature | ||
as well in order to be executed. The previous example demonstrates that for the | ||
`setContents` command. | ||
|
||
Extensions that are modifying (e.g. post-processing) persisted form definition | ||
files using the file abstraction layer (FAL) API need to adjust and extend their | ||
implementation and allow according invocations as outlined above. | ||
|
||
See :issue:`84910` | ||
.. index:: Backend, FAL, ext:form |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
declare(strict_types = 1); | ||
namespace TYPO3\CMS\Form\Hooks; | ||
|
||
/* | ||
* 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! | ||
*/ | ||
|
||
use TYPO3\CMS\Core\Utility\StringUtility; | ||
use TYPO3\CMS\Filelist\FileList; | ||
use TYPO3\CMS\Filelist\FileListEditIconHookInterface; | ||
use TYPO3\CMS\Form\Mvc\Persistence\FormPersistenceManager; | ||
|
||
/** | ||
*/ | ||
class FileListEditIconsHook implements FileListEditIconHookInterface | ||
{ | ||
|
||
/** | ||
* Modifies edit icon array | ||
* | ||
* @param array $cells | ||
* @param FileList $parentObject | ||
*/ | ||
public function manipulateEditIcons(&$cells, &$parentObject) | ||
{ | ||
$fileOrFolderObject = $cells['__fileOrFolderObject']; | ||
$fullIdentifier = $fileOrFolderObject->getCombinedIdentifier(); | ||
$isFormDefinition = StringUtility::endsWith($fullIdentifier, FormPersistenceManager::FORM_DEFINITION_FILE_EXTENSION); | ||
|
||
if (!$isFormDefinition) { | ||
return; | ||
} | ||
|
||
$disableIconNames = ['edit', 'view', 'replace', 'rename']; | ||
foreach ($disableIconNames as $disableIconName) { | ||
if (!empty($cells[$disableIconName])) { | ||
$cells[$disableIconName] = $parentObject->spaceIcon; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.