Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.

Fix/latest versions security #56

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions services/class.tx_caretakerinstance_TYPO3VersionTestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,22 @@ public function runTest()
*/
protected function checkForLatestVersion($versionString, $allowUnstable = false)
{
if (strpos($versionString, '.latest') !== false) {
if (strpos($versionString, '.latest') !== false || strpos($versionString, '.secure') !== false) {
$versionDigits = explode('.', $versionString, 3);
$latestVersions = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Registry')->get('tx_caretaker', $allowUnstable ? 'TYPO3versions' : 'TYPO3versionsStable');
$newVersionString = $latestVersions[$versionDigits[0] . '.' . $versionDigits[1]];
$versionSource = 'TYPO3versionsSecurity';
if (strpos($versionString, '.latest') !== false) {
$versionSource = $allowUnstable ? 'TYPO3versions' : 'TYPO3versionsStable';
}
$latestVersions = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\CMS\Core\Registry')->get('tx_caretaker', $versionSource);

$newVersionString = isset($latestVersions[$versionDigits[0] . '.' . $versionDigits[1]])
? $latestVersions[$versionDigits[0] . '.' . $versionDigits[1]]
: false;
if (!$newVersionString) {
// try with single version number, used since TYPO3 CMS 7
$newVersionString = $latestVersions[$versionDigits[0]];
$newVersionString = isset($latestVersions[$versionDigits[0]])
? $latestVersions[$versionDigits[0]]
: false;
}

if (!empty($newVersionString)) {
Expand Down
4 changes: 2 additions & 2 deletions services/ds.tx_caretakerinstance_TYPO3VersionTestService.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<el>
<min_version>
<TCEforms>
<label>Minimal allowed Version (e.g. '4.3.2' or '4.3.latest')</label>
<label>Minimal allowed Version (e.g. '4.3.2' or '4.3.latest' or '4.3.secure')</label>
<config>
<type>input</type>
<size>30</size>
Expand All @@ -29,7 +29,7 @@
</min_version>
<max_version>
<TCEforms>
<label>Maximal allowed Version (e.g. '4.3.2' or '4.3.latest')</label>
<label>Maximal allowed Version (e.g. '4.3.2' or '4.3.latest' or '4.3.secure')</label>
<config>
<type>input</type>
<size>30</size>
Expand Down