mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
Added preprocessor defines to SUConstants.h for turning on/off DSA and downgrades. We let users downgrade using our URL scheme, and we warn them beforehand, so the downgrade possible attack paranoia gets in the way.
This commit is contained in:
1 parent
8c67631efb
commit
d0b802e09b
4 files changed
+6
-2
No files matched your search
@@ -168,7 +168,7 @@
|
||||
|
||||
- (void)downloadDidFinish:(NSURLDownload *)d
|
||||
{
|
||||
#if 0 // +++
|
||||
#if !ENDANGER_USERS_WITH_INSECURE_UPDATES
|
||||
// New in Sparkle 1.5: we're now checking signatures on all non-secure downloads, where "secure" is defined as both the appcast and the download being transmitted over SSL.
|
||||
NSURL *downloadURL = [[d request] URL];
|
||||
if (!(([[downloadURL scheme] isEqualToString:@"https"] && [[appcastURL scheme] isEqualToString:@"https"]) ||
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#ifndef SUCONSTANTS_H
|
||||
#define SUCONSTANTS_H
|
||||
|
||||
#define ENDANGER_USERS_WITH_INSECURE_UPDATES 1
|
||||
#define PERMIT_AUTOMATED_DOWNGRADES 1
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Notifications:
|
||||
|
||||
@@ -51,6 +51,7 @@ NSString *SUInstallerErrorKey = @"SUInstallerError";
|
||||
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator
|
||||
{
|
||||
// Prevent malicious downgrades:
|
||||
#if !PERMIT_AUTOMATED_DOWNGRADES
|
||||
if ([comparator compareVersion:[host version] toVersion:[[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]] == NSOrderedDescending)
|
||||
{
|
||||
NSString * errorMessage = [NSString stringWithFormat:@"Sparkle Updater: Possible attack in progress! Attempting to \"upgrade\" from %@ to %@. Aborting update.", [host version], [[NSBundle bundleWithPath:path] objectForInfoDictionaryKey:@"CFBundleVersion"]];
|
||||
@@ -58,6 +59,7 @@ NSString *SUInstallerErrorKey = @"SUInstallerError";
|
||||
[self _finishInstallationWithResult:NO host:host error:error delegate:delegate];
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
NSString *targetPath = [host installationPath];
|
||||
NSString *tempName = [self temporaryNameForPath:targetPath];
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
host = [[SUHost alloc] initWithBundle:bundle];
|
||||
[self registerAsObserver];
|
||||
|
||||
#if 0
|
||||
#if !ENDANGER_USERS_WITH_INSECURE_UPDATES
|
||||
// Saving-the-developer-from-a-stupid-mistake-check:
|
||||
if (![[[self feedURL] scheme] isEqualToString:@"https"] && ![host publicDSAKey])
|
||||
NSRunAlertPanel(@"Insecure update error!", @"For security reasons, you need to distribute your appcast over SSL or sign your updates. See Sparkle's documentation for more information.", @"OK", nil, nil);
|
||||
|
||||
Reference in new issue
Block a user