diff --git a/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php b/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php index be665302ded58daedefbb6dd086c6c92d9af99fa..8b359c18cdc344ffda5fdb071a34180361999843 100644 --- a/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php +++ b/typo3/sysext/core/Classes/Configuration/ConfigurationManager.php @@ -66,6 +66,7 @@ class ConfigurationManager 'EXTCONF', 'DB', 'SYS/caching/cacheConfigurations', + 'SYS/encryptionKey', 'SYS/session', 'EXTENSIONS', ]; diff --git a/typo3/sysext/core/Classes/Log/Writer/FileWriter.php b/typo3/sysext/core/Classes/Log/Writer/FileWriter.php index f01b3a9f21a8da444d2bc6a884c1f9ceead9194f..2acf19f06c126defd9574c91fc634e5e98c4ebf9 100644 --- a/typo3/sysext/core/Classes/Log/Writer/FileWriter.php +++ b/typo3/sysext/core/Classes/Log/Writer/FileWriter.php @@ -66,7 +66,10 @@ class FileWriter extends AbstractWriter { // the parent constructor reads $options and sets them parent::__construct($options); - if (empty($options['logFile'])) { + if (empty($options['logFile']) && + // omit logging if TYPO3 has not been configured (avoid creating a guessable filename) + ($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] ?? '') !== '' + ) { $this->setLogFile($this->getDefaultLogFileName()); } } @@ -76,6 +79,9 @@ class FileWriter extends AbstractWriter */ public function __destruct() { + if ($this->logFile === '') { + return; + } self::$logFileHandlesCount[$this->logFile]--; if (self::$logFileHandlesCount[$this->logFile] <= 0) { $this->closeLogFile(); @@ -130,6 +136,10 @@ class FileWriter extends AbstractWriter */ public function writeLog(LogRecord $record) { + if ($this->logFile === '') { + return $this; + } + $data = ''; $context = $record->getData(); $message = $record->getMessage(); diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index a61c88d7485a769fb9b8b6e79b775daf67c98972..f72582bfd578e97b19579afe0a237a852b83edd5 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -81,7 +81,6 @@ return [ ], 'createGroup' => '', 'sitename' => 'TYPO3', - 'encryptionKey' => '', 'cookieDomain' => '', 'trustedHostsPattern' => 'SERVER_NAME', 'devIPmask' => '127.0.0.1,::1', diff --git a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml index e2e5b10d16f536ff6fadc61c91c5f630b1258811..89b5cca33669ab6719a2d4a0c88618f0771756e3 100644 --- a/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml +++ b/typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml @@ -76,9 +76,6 @@ SYS: sitename: type: text description: 'Name of the base-site.' - encryptionKey: - type: text - description: 'This is a "salt" used for various kinds of encryption, CRC checksums and validations. You can enter any rubbish string here but try to keep it secret. You should notice that a change to this value might invalidate temporary information, URLs etc. At least, clear all cache if you change this so any such information can be rebuilt with the new key.' cookieDomain: type: text description: 'Restricts the domain name for FE and BE session cookies. When setting the value to ".domain.com" (replace domain.com with your domain!), login sessions will be shared across subdomains. Alternatively, if you have more than one domain with sub-domains, you can set the value to a regular expression to match against the domain of the HTTP request. The result of the match is used as the domain for the cookie. eg. <code>/\.(example1|example2)\.com$/</code> or <code>/\.(example1\.com)|(example2\.net)$/</code>. Separate domains for FE and BE can be set using <a href="#FE-cookieDomain">$TYPO3_CONF_VARS[''FE''][''cookieDomain'']</a> and <a href="#BE-cookieDomain">$TYPO3_CONF_VARS[''BE''][''cookieDomain'']</a> respectively.' diff --git a/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php b/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php index 0911003ba1c36ad22ad1c23ca2b9a10da0d3862a..c2db2b2fde5edeba55d6f007f11bedfe28b06831 100644 --- a/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php +++ b/typo3/sysext/core/Tests/UnitDeprecated/TypoScript/Parser/TypoScriptParserTest.php @@ -667,7 +667,9 @@ test.TYPO3Forever.TypoScript = 1 */ public function importFiles(string $typoScript, string $expected): void { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'secret-encryption-key-test'; $resolvedIncludeLines = TypoScriptParser::checkIncludeLines($typoScript); + unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']); self::assertEquals($expected, $resolvedIncludeLines); } diff --git a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Routing/UriBuilderTest.php b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Routing/UriBuilderTest.php index d50addfc19932513f0c35582616d8af4cb051a45..efaea1884cbabe4670877d1323b402e23f157ea7 100644 --- a/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Routing/UriBuilderTest.php +++ b/typo3/sysext/extbase/Tests/UnitDeprecated/Mvc/Web/Routing/UriBuilderTest.php @@ -37,6 +37,7 @@ final class UriBuilderTest extends UnitTestCase { parent::setUp(); $this->mockExtensionService = $this->createMock(ExtensionService::class); + $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'secret-encryption-key-test'; $this->subject = $this->getAccessibleMock(UriBuilder::class, ['build']); $this->subject->setRequest($this->createMock(Request::class)); $this->subject->injectConfigurationManager($this->createMock(ConfigurationManagerInterface::class)); @@ -44,6 +45,12 @@ final class UriBuilderTest extends UnitTestCase $this->subject->_set('contentObject', $this->createMock(ContentObjectRenderer::class)); } + protected function tearDown(): void + { + unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']); + parent::tearDown(); + } + /** * @test */