[BUGFIX] T3editor: Honour fileDenyPattern on saving included TS 60/25060/4
authorStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 29 Oct 2013 21:22:27 +0000 (22:22 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sat, 9 Nov 2013 15:28:16 +0000 (16:28 +0100)
fileDenyPattern is only checked on loading so far.
Needs to be added for saving as well taken into account, since
otherwise an arbitrary file (including .php) can be overwritten.

Change-Id: Ia7edc83c8954942fb848746abc0980a304a1a6df
Resolves: #53195
Releases: 6.2, 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/25060
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
t3lib/class.t3lib_tsparser.php

index 2450b2a..0186f8b 100644 (file)
@@ -712,6 +712,10 @@ class t3lib_TSparser {
                                        $realFileName = t3lib_div::getFileAbsFileName($fileName);
 
                                                // some file checks
+                                       if (!t3lib_div::verifyFilenameAgainstDenyPattern($realFileName)) {
+                                               throw new Exception(sprintf('File "%s" was not included since it is not allowed due to fileDenyPattern.', $fileName));
+                                       }
+
                                        if (empty($realFileName)) {
                                                throw new Exception(sprintf('"%s" is not a valid file location.', $fileName));
                                        }