mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-30 05:28:50 +00:00
This patch prevents malicious downgrades, which are still possible with DSA validation: suppose there's some (signed) version with a security hole. A malicious attacker could serve an appcast with that version's URL and DSA signature, but a higher version number, forcing the user to "upgrade" to the version with the security hole. While I was at it, I fixed a bug that should have completely stopped .pkg installation from working since 1.5b1. Why didn't I hear anything about that? Does anyone actually use .pkgs? It still needs testing to be sure it works.
33 lines
1.3 KiB
Objective-C
33 lines
1.3 KiB
Objective-C
//
|
|
// SUPackageInstaller.m
|
|
// Sparkle
|
|
//
|
|
// Created by Andy Matuschak on 4/10/08.
|
|
// Copyright 2008 Andy Matuschak. All rights reserved.
|
|
//
|
|
|
|
#import "SUPackageInstaller.h"
|
|
|
|
|
|
@implementation SUPackageInstaller
|
|
|
|
+ (void)performInstallationWithPath:(NSString *)path host:(SUHost *)host delegate:delegate synchronously:(BOOL)synchronously versionComparator:(id <SUVersionComparison>)comparator;
|
|
{
|
|
NSError *error = nil;
|
|
BOOL result = YES;
|
|
|
|
NSString *installerPath = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.installer"];
|
|
installerPath = [installerPath stringByAppendingString:@"/Contents/MacOS/Installer"];
|
|
if (![[NSFileManager defaultManager] fileExistsAtPath:installerPath])
|
|
{
|
|
error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingInstallerToolError userInfo:[NSDictionary dictionaryWithObject:@"Couldn't find Apple's installer tool!" forKey:NSLocalizedDescriptionKey]];
|
|
result = NO;
|
|
}
|
|
NSTask *installer = [NSTask launchedTaskWithLaunchPath:installerPath arguments:[NSArray arrayWithObjects:path, nil]];
|
|
[installer waitUntilExit];
|
|
// Known bug: if the installation fails or is canceled, Sparkle goes ahead and restarts, thinking everything is fine.
|
|
[self _finishInstallationWithResult:result host:host error:error delegate:delegate];
|
|
}
|
|
|
|
@end
|