From 3f153555c12198bdb6c31f0c48fcdedfbf9ba442 Mon Sep 17 00:00:00 2001
From: Benni Mack <benni@typo3.org>
Date: Fri, 8 Sep 2017 12:54:12 +0200
Subject: [PATCH] [!!!][TASK] Remove option to allow uploading system
 extensions

The extension manager has the option to upload an extension
into typo3/sysext/, which is no recommendation and should
not be an option from the Backend UI itself, as it is heavily
conflicting with core updates where typo3_src/ / sysext is
exchanged.

The option is removed without substitution, if somebody
wants to play with typo3/sysext/ it's at the admins own risk,
and should not be encouraged or mentioned neither in the install
tool (All Configuration) nor Extension Manager.

Resolves: #82377
Releases: master
Change-Id: I19782a4960bb52bd2012b79e912e483610d297d8
Reviewed-on: https://review.typo3.org/54008
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Configuration/DefaultConfiguration.php    |  1 -
 .../DefaultConfigurationDescription.yaml      |  3 --
 ...oAllowUploadingSystemExtensionsRemoved.rst | 45 +++++++++++++++++++
 .../Classes/Domain/Model/Extension.php        |  3 --
 .../SilentConfigurationUpgradeService.php     |  2 +
 .../Php/ArrayDimensionMatcher.php             |  5 +++
 6 files changed, 52 insertions(+), 7 deletions(-)
 create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-82377-OptionToAllowUploadingSystemExtensionsRemoved.rst

diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php
index ae74ded3a5aa..01b4d1e90818 100644
--- a/typo3/sysext/core/Configuration/DefaultConfiguration.php
+++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php
@@ -808,7 +808,6 @@ return [
     'EXT' => [ // Options related to the Extension Management
         'allowGlobalInstall' => false,
         'allowLocalInstall' => true,
-        'allowSystemInstall' => false,
         'excludeForPackaging' => '(?:\\..*(?!htaccess)|.*~|.*\\.swp|.*\\.bak|\\.sass-cache|node_modules|bower_components)',
         'extConf' => [
             'saltedpasswords' => serialize([
diff --git a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
index 6578bd2ac43f..d8aaad813957 100644
--- a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
+++ b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
@@ -227,9 +227,6 @@ EXT:
         allowLocalInstall:
             type: bool
             description: 'If set, local extensions in typo3conf/ext/ are allowed to be installed, updated and deleted etc.'
-        allowSystemInstall:
-            type: bool
-            description: 'If set, you can install extensions in the sysext/ dir.'
         excludeForPackaging:
             type: list
             description: 'List of directories and files which will not be packaged into extensions nor taken into account otherwise by the Extension Manager. Perl regular expression syntax!'
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82377-OptionToAllowUploadingSystemExtensionsRemoved.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82377-OptionToAllowUploadingSystemExtensionsRemoved.rst
new file mode 100644
index 000000000000..945415384f4a
--- /dev/null
+++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82377-OptionToAllowUploadingSystemExtensionsRemoved.rst
@@ -0,0 +1,45 @@
+.. include:: ../../Includes.txt
+
+======================================================================
+Breaking: #82377 - Option to allow uploading system extensions removed
+======================================================================
+
+See :issue:`82377`
+
+Description
+===========
+
+The option to allow uploading additional extensions as system extensions in TYPO3 has been removed
+without substitution.
+
+Disclaimer: It is highly discouraged by the TYPO3 Core to modify anything within `typo3/sysext/`,
+especially adding extensions, as typo3conf/ is the folder to add or override extensions.
+
+If an administrator needs to do changes within `typo3/sysext/` it's at his/her own risk,
+and should not be encouraged to be possible from TYPO3 itself.
+
+
+Impact
+======
+
+The possibility to upload an extension into `typo3/sysext/` via the Extension Manager / TYPO3 Backend
+interface is removed. System extensions can only be added or modified via the file system now.
+
+
+Affected Installations
+======================
+
+TYPO3 instances having the option `$GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall']` enabled and do not
+run in TYPO3's Composer Mode.
+
+As this option was disabled by default for over 10 years, it is highly unlikely this change will
+affect a regular instance.
+
+
+Migration
+=========
+
+The mentioned option, if set, is automatically removed when accessing the Install Tool through
+the SilentMigrationService.
+
+.. index:: LocalConfiguration, FullyScanned
diff --git a/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php b/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php
index 0d8a595e3ff4..7628d16d3597 100644
--- a/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php
+++ b/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php
@@ -467,9 +467,6 @@ class Extension extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
     public static function returnAllowedInstallPaths()
     {
         $installPaths = self::returnInstallPaths();
-        if (empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowSystemInstall'])) {
-            unset($installPaths['System']);
-        }
         if (empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['allowGlobalInstall'])) {
             unset($installPaths['Global']);
         }
diff --git a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
index 028cc33ed758..66febc9ed4b5 100644
--- a/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
+++ b/typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
@@ -100,6 +100,8 @@ class SilentConfigurationUpgradeService
         // #82162
         'SYS/enable_errorDLOG',
         'SYS/enable_exceptionDLOG',
+        // #82377
+        'EXT/allowSystemInstall',
     ];
 
     public function __construct(ConfigurationManager $configurationManager = null)
diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
index b6d0b5bed71d..aca7d122c0b5 100644
--- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
+++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
@@ -69,4 +69,9 @@ return [
             'Deprecation-82254-DeprecateGLOBALSTYPO3_CONF_VARSEXTextConf.rst',
         ],
     ],
+    '$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXT\'][\'allowSystemInstall\']' => [
+        'restFiles' => [
+            'Breaking-82377-OptionToAllowUploadingSystemExtensionsRemoved.rst',
+        ],
+    ],
 ];
-- 
GitLab