From e1f93ed4e733dc1c78a6b658f40a186fe4d26b1f Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 29 Nov 2026 19:15:29 -0800 Subject: [PATCH] Disable key rotation fallback if signed feed failures don't expire If SUSignedFeedFailureExpirationInterval is disabled (set to zero) this means a valid signed feed needs to always be present and no expiration is taken in place. In this case a developer must have access to their EdDSA signing keys, so it doesn't make sense to allow key rotation fallback on the update archive. --- Autoupdate/AppInstaller.m | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Autoupdate/AppInstaller.m b/Autoupdate/AppInstaller.m index 0bafd7f6..bf4f7069 100644 --- a/Autoupdate/AppInstaller.m +++ b/Autoupdate/AppInstaller.m @@ -296,9 +296,13 @@ static const NSTimeInterval SUTerminationRequestTargetWaitDelay = 2.0; if (![_updateValidator validateHostHasPublicKeys:&prevalidationError]) { success = NO; } else { - // Falling back on code signing for prevalidation requires SUVerifyUpdateBeforeExtraction - // and that update is a regular app update, and not a delta update - BOOL fallbackOnCodeSigning = (verifyBeforeExtraction && !archiveTypeMustValidateBeforeExtraction && [_installationType isEqualToString:SPUInstallationTypeApplication]); + // Falling back on code signing for prevalidation requires SUVerifyUpdateBeforeExtraction, + // SURequireSignedFeed is off or SUSignedFeedFailureExpirationInterval is not zero, + // the update is a regular app update, and not a delta update + NSNumber *signedFeedFailureExpirationInterval = [_host doubleNumberForInfoDictionaryKey:SUSignedFeedFailureExpirationIntervalKey]; + BOOL signedFeedFailuresNeverExpire = _host.requiresSignedAppcast && signedFeedFailureExpirationInterval != nil && fpclassify(signedFeedFailureExpirationInterval.doubleValue) == FP_ZERO; + + BOOL fallbackOnCodeSigning = (verifyBeforeExtraction && !archiveTypeMustValidateBeforeExtraction && [_installationType isEqualToString:SPUInstallationTypeApplication] && !signedFeedFailuresNeverExpire); success = [_updateValidator validateDownloadPathWithFallbackOnCodeSigning:fallbackOnCodeSigning error:&prevalidationError]; }