From 6e370a5ab8293da6a028da49a33f67e9b20d86e1 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 15 May 2026 20:56:47 -0700 Subject: [PATCH] Enforce connection to installer to be validated before receiving appcast item data (#2876) --- Autoupdate/AppInstaller.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index 38710b2b..9d234871 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -97,6 +97,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; // Setting _performedStage1Installation on main thread must be synchronzied with reading it from new connection handler BOOL _performedStage1Installation; + BOOL _receivedAppcastItemData; BOOL _performedStage2Installation; BOOL _performedStage3Installation; @@ -142,9 +143,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; BOOL connectionCodeSigningValidationSkipped = NO; #endif - // It's safe to allow any connections once stage 1 installation is complete + // It's safe to allow any connections once stage 1 installation is complete and appcast data has been received. // This is to allow general updaters to resume the installation. - if (!_performedStage1Installation) { + if (!_performedStage1Installation || !_receivedAppcastItemData) { BOOL passesValidation; NSError *validationError = nil; SUValidateConnectionStatus status = [SUCodeSigningVerifier validateConnection:newConnection error:&validationError]; @@ -597,6 +598,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7; [self extractAndInstallUpdate]; }); } else if (identifier == SPUSentUpdateAppcastItemData) { + os_unfair_lock_lock(&_newConnectionLock); + _receivedAppcastItemData = YES; + os_unfair_lock_unlock(&_newConnectionLock); + SUAppcastItem *updateItem = (data != nil) ? (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]) : nil; if (updateItem != nil) { SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem];