diff --git a/SUBasicUpdateDriver.m b/SUBasicUpdateDriver.m index cad0aac5..a21b98ee 100644 --- a/SUBasicUpdateDriver.m +++ b/SUBasicUpdateDriver.m @@ -290,20 +290,18 @@ - (void)installWithToolAndRelaunch:(BOOL)relaunch displayingUserInterface:(BOOL)showUI { -#if !ENDANGER_USERS_WITH_INSECURE_UPDATES if (![self validateUpdateDownloadedToPath:downloadPath extractedToPath:tempDir DSASignature:[updateItem DSASignature] publicDSAKey:[host publicDSAKey]]) { [self abortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUSignatureError userInfo:@{NSLocalizedDescriptionKey: SULocalizedString(@"An error occurred while extracting the archive. Please try again later.", nil), NSLocalizedFailureReasonErrorKey: @"The update is improperly signed."}]]; return; } -#endif - + if (![updater mayUpdateAndRestart]) { [self abortUpdate]; return; } - + // Give the host app an opportunity to postpone the install and relaunch. static BOOL postponedOnce = NO; if (!postponedOnce && [[updater delegate] respondsToSelector:@selector(updater:shouldPostponeRelaunchForUpdate:untilInvoking:)]) diff --git a/SUConstants.h b/SUConstants.h index c6126a8b..854ce0cd 100644 --- a/SUConstants.h +++ b/SUConstants.h @@ -14,9 +14,6 @@ // Preprocessor flags: // ----------------------------------------------------------------------------- -// Turn off DSA signature check (practically invites man-in-the-middle attacks): -#define ENDANGER_USERS_WITH_INSECURE_UPDATES 0 - // Sparkle usually doesn't allow downgrades as they're usually accidental, but // if your app has a downgrade function or URL handler, turn this on: #define PERMIT_AUTOMATED_DOWNGRADES 0 diff --git a/SUUpdater.m b/SUUpdater.m index 7ccca4c8..d9f5eee4 100644 --- a/SUUpdater.m +++ b/SUUpdater.m @@ -93,8 +93,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault } sharedUpdaters[[NSValue valueWithNonretainedObject:bundle]] = self; host = [[SUHost alloc] initWithBundle:bundle]; - -#if !ENDANGER_USERS_WITH_INSECURE_UPDATES + // Saving-the-developer-from-a-stupid-mistake-check: BOOL hasPublicDSAKey = [host publicDSAKey] != nil; BOOL isMainBundle = [bundle isEqualTo:[NSBundle mainBundle]]; @@ -108,7 +107,7 @@ static NSString * const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefault NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to code sign your application or sign your updates with a DSA key. See Sparkle's documentation for more information.", @"OK", nil, nil); [self notifyDidShowModalAlert]; } -#endif + // This runs the permission prompt if needed, but never before the app has finished launching because the runloop won't run before that [self performSelector:@selector(startUpdateCycle) withObject:nil afterDelay:0]; }