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 4 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
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,13 @@ 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');
$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 = $latestVersions[$versionDigits[0] . '.' . $versionDigits[1]];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we cleanup this code as well? This might raise notices for undefined version keys.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, would be nice to just make it cleaner. I'll take care of that!

if (!$newVersionString) {
// try with single version number, used since TYPO3 CMS 7
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