Skip to content

Commit 989dae9

Browse files
authored
[5.4] Skip version infos for potential downgrades in TUF (joomla#45964)
1 parent 029040c commit 989dae9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

libraries/src/Updater/Update.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,11 @@ public function loadFromTuf(TufMetadata $metadataTable, string $url, $minimumSta
562562
$constraintChecker = new ConstraintChecker();
563563

564564
foreach ($data['signed']['targets'] as $target) {
565+
// Check if this target is older than the currently installed version
566+
if (version_compare($target['custom']['version'], JVERSION, '<')) {
567+
continue;
568+
}
569+
565570
// Check if this target is newer than the current version
566571
if (isset($this->latest) && version_compare($target['custom']['version'], $this->latest->version, '<')) {
567572
continue;
@@ -607,6 +612,10 @@ public function loadFromTuf(TufMetadata $metadataTable, string $url, $minimumSta
607612

608613
// If the latest item is set then we transfer it to where we want to
609614
if (isset($this->latest)) {
615+
foreach (get_object_vars($this->latest) as $key => $val) {
616+
$this->$key = (object) ['_data' => $val];
617+
}
618+
610619
foreach ($this->downloadSources as $source) {
611620
$this->downloadurl = (object) [
612621
'_data' => $source->url,

0 commit comments

Comments
 (0)