Compare commits

..
Author SHA1 Message Date
Zorg 4eaedee9ab Add custom timeout setting for testing unreliable connection 2024-12-06 22:48:22 -08:00
96 changed files with 284 additions and 1111 deletions

No files matched your search

+1 -1
View File
@@ -104,4 +104,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Sparkle-distribution-${{ matrix.xcode }}.tar.xz
path: build/Build/Products/Release/sparkle_dist.tar.xz
path: build/Build/Products/Release/sparkle-dist.tar.xz
+4 -26
View File
@@ -10,8 +10,6 @@
#import "SPUMessageTypes.h"
#import "SPUInstallerAgentProtocol.h"
#import "SUInstallerAgentInitiationProtocol.h"
#import "SUCodeSigningVerifier.h"
#import "SULog.h"
#include "AppKitPrevention.h"
@@ -54,7 +52,7 @@
_delegate = nil;
[_activeConnection invalidate];
// Don't need to set _activeConnection to nil, we don't expect new connections
_activeConnection = nil;
[_xpcListener invalidate];
_xpcListener = nil;
@@ -63,29 +61,10 @@
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
if (_activeConnection != nil) {
SULog(SULogLevelError, @"Error: Rejecting new connection for agent due already having an active connection");
[newConnection invalidate];
return NO;
}
// Hardening but not critical for security
NSError *validationError = nil;
SUValidateConnectionStatus validationStatus = [SUCodeSigningVerifier validateConnection:newConnection options:SUValidateConnectionOptionDefault error:&validationError];
switch (validationStatus) {
case SUValidateConnectionStatusSetCodeSigningRequirementSuccess:
break;
case SUValidateConnectionStatusSetNoRequirementSuccess:
break;
case SUValidateConnectionStatusAPIFailure:
case SUValidateConnectionStatusCodeSigningRequirementFailure:
case SUValidateConectionNoSupportedValidationMethodFailure:
SULog(SULogLevelError, @"Error: Rejecting new connection for agent due to failing validation of XPC connection with status %lu and error: %@", validationStatus, validationError.localizedDescription);
[newConnection invalidate];
return NO;
}
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerAgentInitiationProtocol)];
newConnection.exportedObject = self;
@@ -112,9 +91,10 @@
});
};
_agent = newConnection.remoteObjectProxy;
[newConnection resume];
_agent = newConnection.remoteObjectProxy;
return YES;
}
@@ -126,9 +106,7 @@
[self->_delegate agentConnectionDidInitiate];
});
if (acknowledgement != NULL) {
acknowledgement();
}
acknowledgement();
}
- (void)connectionWillInvalidateWithError:(NSError *)error
+27 -134
View File
@@ -28,9 +28,6 @@
#import "SPUInstallationType.h"
#import "SPULocalCacheDirectory.h"
#import "SPUVerifierInformation.h"
#import "SUConstants.h"
#import "SUCodeSigningVerifier.h"
#import <os/lock.h>
#include "AppKitPrevention.h"
@@ -51,10 +48,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
@implementation AppInstaller
{
NSXPCListener* _xpcListener;
// Must be synchronized with _newConnectionLock
// Set from new connection handler, and also set/read from main thread
NSXPCConnection *_activeConnection;
id<SUInstallerCommunicationProtocol> _communicator;
AgentConnection *_agentConnection;
@@ -77,14 +71,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_queue_t _installerQueue;
os_unfair_lock _newConnectionLock;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
// Must be synchronized with _newConnectionLock
// Set from new connection handler, read from main thread
BOOL _connectionCodeSigningValidationSkipped;
#endif
BOOL _shouldRelaunch;
BOOL _shouldShowUI;
@@ -95,9 +81,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
BOOL _finishedValidation;
BOOL _agentInitiatedConnection;
// Setting _performedStage1Installation on main thread must be synchronzied with reading it from new connection handler
BOOL _performedStage1Installation;
BOOL _performedStage2Installation;
BOOL _performedStage3Installation;
@@ -110,8 +94,6 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
return nil;
}
_newConnectionLock = OS_UNFAIR_LOCK_INIT;
_hostBundleIdentifier = [hostBundleIdentifier copy];
_homeDirectory = [homeDirectory copy];
@@ -127,59 +109,13 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection
{
os_unfair_lock_lock(&_newConnectionLock);
{
if (_activeConnection != nil) {
os_unfair_lock_unlock(&_newConnectionLock);
SULog(SULogLevelError, @"Error: Rejecting multiple XPC connections for installer...");
[newConnection invalidate];
return NO;
}
#if SPARKLE_BUILD_PACKAGE_SUPPORT
BOOL connectionCodeSigningValidationSkipped = NO;
#endif
// It's safe to allow any connections once stage 1 installation is complete
// This is to allow general updaters to resume the installation.
if (!_performedStage1Installation) {
BOOL passesValidation;
NSError *validationError = nil;
SUValidateConnectionStatus status = [SUCodeSigningVerifier validateConnection:newConnection options:SUValidateConnectionOptionDefault error:&validationError];
switch (status) {
case SUValidateConnectionStatusSetCodeSigningRequirementSuccess:
passesValidation = YES;
break;
case SUValidateConnectionStatusSetNoRequirementSuccess:
passesValidation = YES;
#if SPARKLE_BUILD_PACKAGE_SUPPORT
connectionCodeSigningValidationSkipped = YES;
#endif
break;
case SUValidateConnectionStatusAPIFailure:
case SUValidateConnectionStatusCodeSigningRequirementFailure:
case SUValidateConectionNoSupportedValidationMethodFailure:
passesValidation = NO;
break;
}
if (!passesValidation) {
os_unfair_lock_unlock(&_newConnectionLock);
SULog(SULogLevelError, @"Error: Rejecting new connection for installer due to failing validation of XPC connection with status %lu and error: %@", status, validationError.localizedDescription);
[newConnection invalidate];
return NO;
}
}
#if SPARKLE_BUILD_PACKAGE_SUPPORT
_connectionCodeSigningValidationSkipped = connectionCodeSigningValidationSkipped;
#endif
_activeConnection = newConnection;
if (_activeConnection != nil) {
SULog(SULogLevelDefault, @"Rejecting multiple connections...");
[newConnection invalidate];
return NO;
}
os_unfair_lock_unlock(&_newConnectionLock);
_activeConnection = newConnection;
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerCommunicationProtocol)];
newConnection.exportedObject = self;
@@ -191,11 +127,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil) {
os_unfair_lock_lock(&strongSelf->_newConnectionLock);
NSXPCConnection *activeConnection = strongSelf->_activeConnection;
os_unfair_lock_unlock(&strongSelf->_newConnectionLock);
[activeConnection invalidate];
[strongSelf->_activeConnection invalidate];
}
});
};
@@ -208,19 +140,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[strongSelf cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Invalidation on remote port being called, and installation is not close enough to completion!" }]];
}
strongSelf->_communicator = nil;
os_unfair_lock_lock(&strongSelf->_newConnectionLock);
strongSelf->_activeConnection = nil;
os_unfair_lock_unlock(&strongSelf->_newConnectionLock);
}
});
};
// _communicator is used only on main thread
dispatch_async(dispatch_get_main_queue(), ^{
self->_communicator = newConnection.remoteObjectProxy;
[newConnection resume];
});
[newConnection resume];
_communicator = newConnection.remoteObjectProxy;
return YES;
}
@@ -249,10 +176,10 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
id<SUUnarchiverProtocol> unarchiver = [SUUnarchiver unarchiverForPath:archivePath extractionDirectory:_extractionDirectory updatingHostBundlePath:_host.bundlePath decryptionPassword:_decryptionPassword expectingInstallationType:_installationType];
NSError *prevalidationError = nil;
NSError *unarchiverError = nil;
BOOL success = NO;
if (!unarchiver) {
prevalidationError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No valid unarchiver was found for %@", archivePath] }];
unarchiverError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUUnarchivingError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"No valid unarchiver was found for %@", archivePath] }];
success = NO;
} else {
@@ -265,38 +192,20 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
}
_updateValidator = [[SUUpdateValidator alloc] initWithDownloadPath:archivePath signatures:_signatures host:_host verifierInformation:_verifierInformation];
// More uncommon archives types (.aar, .yaa) need SUVerifyUpdateBeforeExtraction
BOOL verifyBeforeExtraction = [_host boolForInfoDictionaryKey:SUVerifyUpdateBeforeExtractionKey];
if (!verifyBeforeExtraction && unarchiver.needsVerifyBeforeExtractionKey) {
prevalidationError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Extracting %@ archives require setting %@ to YES in the old app. Please visit https://sparkle-project.org/documentation/customization/ for more information.", archivePath.pathExtension, SUVerifyUpdateBeforeExtractionKey] }];
success = NO;
} else {
// Delta, package updates, and apps with SUVerifyUpdateBeforeExtraction will require validation before extraction
// Otherwise normal application updates are a bit more lenient allowing developers to change one of apple dev ID or EdDSA keys after extraction
BOOL archiveTypeMustValidateBeforeExtraction = [[unarchiver class] mustValidateBeforeExtraction];
BOOL needsPrevalidation = verifyBeforeExtraction || archiveTypeMustValidateBeforeExtraction || ![_installationType isEqualToString:SPUInstallationTypeApplication];
if (needsPrevalidation) {
// EdDSA signing is required, so host must have public keys
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]);
success = [_updateValidator validateDownloadPathWithFallbackOnCodeSigning:fallbackOnCodeSigning error:&prevalidationError];
}
} else {
success = YES;
}
// Delta, package updates, and .aar/.yaa archives will require validation before extraction
// Normal application updates are a bit more lenient allowing developers to change one of apple dev ID or EdDSA keys
BOOL needsPrevalidation = [[unarchiver class] mustValidateBeforeExtractionWithArchivePath:archivePath] || ![_installationType isEqualToString:SPUInstallationTypeApplication];
if (needsPrevalidation) {
success = [_updateValidator validateDownloadPathWithError:&unarchiverError];
} else {
success = YES;
}
}
if (!success) {
[self unarchiverDidFailWithError:prevalidationError];
[self unarchiverDidFailWithError:unarchiverError];
} else {
[unarchiver
unarchiveWithCompletionBlock:^(NSError * _Nullable error) {
@@ -432,7 +341,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// Do not rely on eg: self->_updateDirectoryPath != nil because we may set it to nil again if an early stage fails (i.e, archive extraction)
self->_receivedInstallationData = YES;
SPUInstallationInputData *installationData = (data != nil) ? (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]) : nil;
SPUInstallationInputData *installationData = (SPUInstallationInputData *)SPUUnarchiveRootObjectSecurely(data, [SPUInstallationInputData class]);
if (installationData == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to unarchive input installation data" }]];
return;
@@ -597,7 +506,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
[self extractAndInstallUpdate];
});
} else if (identifier == SPUSentUpdateAppcastItemData) {
SUAppcastItem *updateItem = (data != nil) ? (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]) : nil;
SUAppcastItem *updateItem = (SUAppcastItem *)SPUUnarchiveRootObjectSecurely(data, [SUAppcastItem class]);
if (updateItem != nil) {
SPUInstallationInfo *installationInfo = [[SPUInstallationInfo alloc] initWithAppcastItem:updateItem canSilentlyInstall:[_installer canInstallSilently]];
@@ -650,17 +559,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
_installerQueue = dispatch_queue_create("org.sparkle-project.sparkle.installer", queuePriority);
#if SPARKLE_BUILD_PACKAGE_SUPPORT
os_unfair_lock_lock(&_newConnectionLock);
BOOL connectionCodeSigningValidationSkipped = self->_connectionCodeSigningValidationSkipped;
os_unfair_lock_unlock(&_newConnectionLock);
#else
BOOL connectionCodeSigningValidationSkipped = NO;
#endif
dispatch_async(_installerQueue, ^{
NSError *installerError = nil;
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self->_host expectedInstallationType:self->_installationType updateDirectory:self->_extractionDirectory connectionCodeSigningValidationSkipped:connectionCodeSigningValidationSkipped homeDirectory:self->_homeDirectory userName:self->_userName error:&installerError];
id <SUInstallerProtocol> installer = [SUInstaller installerForHost:self->_host expectedInstallationType:self->_installationType updateDirectory:self->_extractionDirectory homeDirectory:self->_homeDirectory userName:self->_userName error:&installerError];
if (installer == nil) {
dispatch_async(dispatch_get_main_queue(), ^{
@@ -684,16 +585,14 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
dispatch_async(dispatch_get_main_queue(), ^{
self->_installer = installer;
os_unfair_lock_lock(&self->_newConnectionLock);
self->_performedStage1Installation = YES;
os_unfair_lock_unlock(&self->_newConnectionLock);
uint8_t sendInformation[] = {canPerformSilentInstall, (uint8_t)self->_targetTerminated};
NSData *sendData = [NSData dataWithBytes:sendInformation length:sizeof(sendInformation)];
[self->_communicator handleMessageWithIdentifier:SPUInstallationFinishedStage1 data:sendData];
self->_performedStage1Installation = YES;
if (self->_targetTerminated) {
// Stage 2 can still be run before we finish installation
// if the updater requests for it before the app is terminated
@@ -810,15 +709,9 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// It's nice to tell the other end we're invalidating
os_unfair_lock_lock(&_newConnectionLock);
NSXPCConnection *activeConnection = _activeConnection;
[_activeConnection invalidate];
_activeConnection = nil;
os_unfair_lock_unlock(&_newConnectionLock);
[activeConnection invalidate];
[_xpcListener invalidate];
_xpcListener = nil;
+4 -4
View File
@@ -216,7 +216,7 @@ typedef struct
}
}
static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode compressionMode)
static compression_algorithm _compressionAlgorithmForMode(SPUDeltaCompressionMode compressionMode)
{
switch (compressionMode) {
case SPUDeltaCompressionModeLZMA:
@@ -310,7 +310,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode
case SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: {
if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_DECODE, compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) {
if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_DECODE, _compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open compression stream for reading" }];
return nil;
}
@@ -844,7 +844,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode
case SPUDeltaCompressionModeLZFSE:
case SPUDeltaCompressionModeLZ4:
case SPUDeltaCompressionModeZLIB: {
if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_ENCODE, compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) {
if (compression_stream_init(&_compressionStream, COMPRESSION_STREAM_ENCODE, _compressionAlgorithmForMode(compression)) != COMPRESSION_STATUS_OK) {
_error = [NSError errorWithDomain:SPARKLE_COMPRESSION_ERROR_DOMAIN code:COMPRESSION_STATUS_ERROR userInfo:@{ NSLocalizedDescriptionKey: @"Failed to open compression stream for writing" }];
return;
@@ -1141,7 +1141,7 @@ static compression_algorithm compressionAlgorithmForMode(SPUDeltaCompressionMode
} else if (S_ISLNK(extractMode)) {
off_t fileSize = itemFileInfo.st_size;
if (fileSize > UINT16_MAX) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path has a destination that is too long: %lld bytes", fileSize] }];
_error = [NSError errorWithDomain:SPARKLE_DELTA_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_ARCHIVE_ERROR_CODE_LINK_TOO_LONG userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Link path has a destination that is too long: %llu bytes", fileSize] }];
break;
}
+2 -2
View File
@@ -228,7 +228,7 @@ extern char *xar_get_safe_path(xar_file_t f) __attribute__((weak_import));
xar_subdoc_prop_set(attributes, AFTER_TREE_SHA1_KEY, [displayHashFromRawHash(header.afterTreeHash) UTF8String]);
}
static xar_file_t xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTable, xar_t x, NSString *relativePath, NSString *filePath)
static xar_file_t _xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTable, xar_t x, NSString *relativePath, NSString *filePath)
{
NSArray<NSString *> *rootRelativePathComponents = relativePath.pathComponents;
// Relative path must at least have starting "/" component and one more path component
@@ -285,7 +285,7 @@ static xar_file_t xarAddFile(NSMutableDictionary<NSString *, NSValue *> *fileTab
SPUDeltaItemCommands commands = item.commands;
uint16_t mode = item.mode;
xar_file_t newFile = xarAddFile(_fileTable, _x, relativeFilePath, filePath);
xar_file_t newFile = _xarAddFile(_fileTable, _x, relativeFilePath, filePath);
if (newFile == NULL) {
_error = [NSError errorWithDomain:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_DOMAIN code:SPARKLE_DELTA_XAR_ARCHIVE_ERROR_CODE_ADD_FAILURE userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Failed to add xar file entry: %@", relativeFilePath] }];
return;
+1 -1
View File
@@ -389,7 +389,7 @@ BOOL applyBinaryDelta(NSString *source, NSString *finalDestination, NSString *pa
}
if (verbose) {
fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [relativePath fileSystemRepresentation], (unsigned int)(mode & PERMISSION_FLAGS));
fprintf(stderr, "\n👮 %s %s (0%o)", VERBOSE_MODIFIED, [relativePath fileSystemRepresentation], mode & PERMISSION_FLAGS);
}
}
}];
+8 -8
View File
@@ -22,7 +22,7 @@
// Note: the framework bundle version must be bumped, and generate_appcast must be updated to compare it,
// when we add/change new major versions and defaults. Unit tests need to be updated to use new versions too.
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionDefault = SUBinaryDeltaMajorVersion4;
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionDefault = SUBinaryDeltaMajorVersion3;
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionLatest = SUBinaryDeltaMajorVersion4;
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst = SUBinaryDeltaMajorVersion1;
SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirstSupported = SUBinaryDeltaMajorVersion2;
@@ -159,7 +159,7 @@ NSString *temporaryDirectory(NSString *base)
return stringWithFileSystemRepresentation(templateResult);
}
static void sha1HashOfBuffer(unsigned char *hash, const char *buffer, ssize_t bufferLength)
static void _sha1HashOfBuffer(unsigned char *hash, const char *buffer, ssize_t bufferLength)
{
assert(bufferLength >= 0 && bufferLength <= UINT32_MAX);
CC_SHA1_CTX hashContext;
@@ -168,7 +168,7 @@ static void sha1HashOfBuffer(unsigned char *hash, const char *buffer, ssize_t bu
CC_SHA1_Final(hash, &hashContext);
}
static BOOL crc32HashOfFileContents(uLong *outChecksum, FTSENT *ent, void *tempBuffer, size_t tempBufferSize)
static BOOL _crc32HashOfFileContents(uLong *outChecksum, FTSENT *ent, void *tempBuffer, size_t tempBufferSize)
{
uLong checksum = *outChecksum;
@@ -220,7 +220,7 @@ static BOOL crc32HashOfFileContents(uLong *outChecksum, FTSENT *ent, void *tempB
return YES;
}
static BOOL sha1HashOfFileContents(unsigned char *hash, FTSENT *ent, void *tempBuffer, size_t tempBufferSize)
static BOOL _sha1HashOfFileContents(unsigned char *hash, FTSENT *ent, void *tempBuffer, size_t tempBufferSize)
{
if (ent->fts_info == FTS_SL) {
char linkDestination[MAXPATHLEN + 1];
@@ -230,11 +230,11 @@ static BOOL sha1HashOfFileContents(unsigned char *hash, FTSENT *ent, void *tempB
return NO;
}
sha1HashOfBuffer(hash, linkDestination, linkDestinationLength);
_sha1HashOfBuffer(hash, linkDestination, linkDestinationLength);
} else if (ent->fts_info == FTS_F) {
ssize_t fileSize = ent->fts_statp->st_size;
if (fileSize <= 0) {
sha1HashOfBuffer(hash, NULL, 0);
_sha1HashOfBuffer(hash, NULL, 0);
} else {
FILE *file = fopen(ent->fts_path, "rb");
if (file == NULL) {
@@ -329,7 +329,7 @@ BOOL getRawHashOfTreeAndFileTablesWithVersion(void *hashBuffer, NSString *path,
fileHashKey = nil;
} else {
uLong fileContentsChecksum = initialCrc32Value;
if (!crc32HashOfFileContents(&fileContentsChecksum, ent, tempBuffer, tempBufferSize)) {
if (!_crc32HashOfFileContents(&fileContentsChecksum, ent, tempBuffer, tempBufferSize)) {
fts_close(fts);
free(tempBuffer);
return NO;
@@ -347,7 +347,7 @@ BOOL getRawHashOfTreeAndFileTablesWithVersion(void *hashBuffer, NSString *path,
}
} else {
unsigned char fileHash[CC_SHA1_DIGEST_LENGTH];
if (!sha1HashOfFileContents(fileHash, ent, tempBuffer, tempBufferSize)) {
if (!_sha1HashOfFileContents(fileHash, ent, tempBuffer, tempBufferSize)) {
fts_close(fts);
free(tempBuffer);
return NO;
+2 -2
View File
@@ -477,7 +477,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
fprintf(stderr, "\n");
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Permissions for Sparkle executable must be 0%o (found 0%o) on file %@", (unsigned int)VALID_SPARKLE_EXECUTABLE_PERMISSIONS, permissions, @(ent->fts_path)] }];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Permissions for Sparkle executable must be 0%o (found 0%o) on file %@", VALID_SPARKLE_EXECUTABLE_PERMISSIONS, permissions, @(ent->fts_path)] }];
}
return NO;
}
@@ -591,7 +591,7 @@ BOOL createBinaryDelta(NSString *source, NSString *destination, NSString *patchF
fprintf(stderr, "\n");
}
if (error != NULL) {
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Permissions for Sparkle executable must be 0%o (found 0%o) on file %@", (unsigned int)VALID_SPARKLE_EXECUTABLE_PERMISSIONS, permissions, @(ent->fts_path)] }];
*error = [NSError errorWithDomain:NSCocoaErrorDomain code:NSFileReadUnknownError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Permissions for Sparkle executable must be 0%o (found 0%o) on file %@", VALID_SPARKLE_EXECUTABLE_PERMISSIONS, permissions, @(ent->fts_path)] }];
}
return NO;
}
+1 -6
View File
@@ -28,7 +28,7 @@
return [[path pathExtension] isEqualToString:@"delta"];
}
+ (BOOL)mustValidateBeforeExtraction
+ (BOOL)mustValidateBeforeExtractionWithArchivePath:(NSString *)archivePath
{
return YES;
}
@@ -83,11 +83,6 @@ SPU_OBJC_DIRECT
return self;
}
- (BOOL)needsVerifyBeforeExtractionKey
{
return NO;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock waitForCleanup:(BOOL)__unused waitForCleanup
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-21
View File
@@ -19,22 +19,6 @@ NS_ASSUME_NONNULL_BEGIN
#define SUCodeSigningVerifierDefinitionAttribute __attribute__((objc_runtime_name("SUTestCodeSigningVerifier")))
#endif
typedef NS_ENUM(NSUInteger, SUValidateConnectionStatus) {
SUValidateConnectionStatusSetCodeSigningRequirementSuccess = 0,
SUValidateConnectionStatusSetNoRequirementSuccess,
SUValidateConnectionStatusAPIFailure,
SUValidateConnectionStatusCodeSigningRequirementFailure,
SUValidateConectionNoSupportedValidationMethodFailure,
};
typedef NS_OPTIONS(NSUInteger, SUValidateConnectionOptions) {
// Default validation behavior (matches against Team ID from main executable if available)
SUValidateConnectionOptionDefault = 0,
// Require that the connecting client has the app sandbox entitlement
SUValidateConnectionOptionRequireSandboxEntitlement = 1 << 0,
};
SUCodeSigningVerifierDefinitionAttribute
@interface SUCodeSigningVerifier : NSObject
@@ -45,14 +29,9 @@ SUCodeSigningVerifierDefinitionAttribute
// Same as above except does not check for nested code. This method should be used by the framework.
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL error:(NSError *__autoreleasing *)error;
+ (BOOL)codeSignatureIsValidAtDownloadURL:(NSURL *)downloadURL andMatchesDeveloperIDTeamFromOldBundleURL:(NSURL *)oldBundleURL error:(NSError * __autoreleasing *)error;
+ (BOOL)bundleAtURLIsCodeSigned:(NSURL *)bundleURL;
+ (NSString * _Nullable)teamIdentifierAtURL:(NSURL *)url;
+ (NSString * _Nullable)teamIdentifierFromMainExecutable;
+ (SUValidateConnectionStatus)validateConnection:(NSXPCConnection *)connection options:(SUValidateConnectionOptions)options error:(NSError * __autoreleasing *)error;
@end
+13 -270
View File
@@ -15,12 +15,6 @@
#include "AppKitPrevention.h"
@interface NSXPCConnection (Private)
@property (nonatomic, readonly) audit_token_t auditToken;
@end
@implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)newBundleURL andMatchesSignatureAtBundleURL:(NSURL *)oldBundleURL error:(NSError * __autoreleasing *)error
@@ -32,17 +26,12 @@
CFErrorRef cfError = NULL;
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)oldBundleURL, kSecCSDefaultFlags, &oldCode);
if (result != noErr) {
if (result == errSecCSUnsigned) {
if (error != NULL) {
NSString *errorMessage =
(result == errSecCSUnsigned) ?
[NSString stringWithFormat:@"Bundle is not code signed: %@", oldBundleURL.path] :
[NSString stringWithFormat:@"Failed to get static code (%d): %@", result, oldBundleURL.path];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Bundle is not code signed: %@", newBundleURL] }];
}
goto finally;
return NO;
}
result = SecCodeCopyDesignatedRequirement(oldCode, kSecCSDefaultFlags, &requirement);
@@ -74,7 +63,7 @@
// See https://github.com/sparkle-project/Sparkle/issues/376#issuecomment-48824267 and https://developer.apple.com/library/mac/technotes/tn2206
// Additionally, there are several reasons to stay away from deep verification and to prefer EdDSA signing the download archive instead.
// See https://github.com/sparkle-project/Sparkle/pull/523#commitcomment-17549302 and https://github.com/sparkle-project/Sparkle/issues/543
SecCSFlags flags = kSecCSCheckAllArchitectures;
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
result = SecStaticCodeCheckValidityWithErrors(staticCode, flags, requirement, &cfError);
if (result != errSecSuccess) {
@@ -160,7 +149,7 @@ finally:
}
// See in -codeSignatureIsValidAtBundleURL:andMatchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed
SecCSFlags flags = kSecCSCheckAllArchitectures;
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
if (checkNestedCode) {
flags |= kSecCSCheckNestedCode;
}
@@ -269,8 +258,15 @@ static id valueOrNSNull(id value) {
return (result == 0);
}
static NSString * _Nullable SUTeamIdentifierFromCode(SecStaticCodeRef staticCode)
+ (NSString * _Nullable)teamIdentifierAtURL:(NSURL *)url
{
SecStaticCodeRef staticCode = NULL;
OSStatus staticCodeResult = SecStaticCodeCreateWithPath((__bridge CFURLRef)url, kSecCSDefaultFlags, &staticCode);
if (staticCodeResult != noErr) {
SULog(SULogLevelError, @"Failed to get static code for retrieving team identifier: %d", staticCodeResult);
return nil;
}
CFDictionaryRef cfSigningInformation = NULL;
OSStatus copySigningInfoCode = SecCodeCopySigningInformation(staticCode, kSecCSSigningInformation,
&cfSigningInformation);
@@ -286,257 +282,4 @@ static NSString * _Nullable SUTeamIdentifierFromCode(SecStaticCodeRef staticCode
return signingInformation[(NSString *)kSecCodeInfoTeamIdentifier];
}
+ (NSString * _Nullable)teamIdentifierAtURL:(NSURL *)url
{
SecStaticCodeRef staticCode = NULL;
OSStatus staticCodeResult = SecStaticCodeCreateWithPath((__bridge CFURLRef)url, kSecCSDefaultFlags, &staticCode);
if (staticCodeResult != errSecSuccess) {
SULog(SULogLevelError, @"Failed to get static code for retrieving team identifier: %d", staticCodeResult);
return nil;
}
NSString *teamIdentifier = SUTeamIdentifierFromCode(staticCode);
if (staticCode != NULL) {
CFRelease(staticCode);
}
return teamIdentifier;
}
+ (NSString * _Nullable)teamIdentifierFromMainExecutable
{
SecCodeRef code = NULL;
OSStatus result = SecCodeCopySelf(kSecCSDefaultFlags, &code);
if (result != errSecSuccess) {
SULog(SULogLevelError, @"Failed to get code for retrieving team identifier of main executable: %d", result);
return nil;
}
NSString *teamIdentifier = SUTeamIdentifierFromCode(code);
CFRelease(code);
return teamIdentifier;
}
+ (BOOL)codeSignatureIsValidAtDownloadURL:(NSURL *)downloadURL andMatchesDeveloperIDTeamFromOldBundleURL:(NSURL *)oldBundleURL error:(NSError * __autoreleasing *)error
{
NSString *teamIdentifier = nil;
NSString *requirementString = nil;
SecRequirementRef requirement = NULL;
SecStaticCodeRef oldStaticCode = NULL;
SecStaticCodeRef downloadStaticCode = NULL;
OSStatus result;
NSError *resultError = nil;
NSString *commonErrorMessage = @"The download archive cannot be validated with Apple Developer ID code signing as fallback (after (Ed)DSA verification has failed)";
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)oldBundleURL, kSecCSDefaultFlags, &oldStaticCode);
if (result != errSecSuccess) {
NSString *errorMessage =
(result == errSecCSUnsigned) ?
[NSString stringWithFormat:@"%@. The original app is not code signed: %@", commonErrorMessage, oldBundleURL.path] :
[NSString stringWithFormat:@"%@. The static code could not be retrieved from the original app (%d): %@", commonErrorMessage, result, oldBundleURL.path];
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: errorMessage }];
goto finally;
}
teamIdentifier = SUTeamIdentifierFromCode(oldStaticCode);
if (teamIdentifier == nil) {
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"%@. The team identifier could not be retrieved from the original app: %@", commonErrorMessage, oldBundleURL.path] }];
goto finally;
}
// Create a designated requirement with developer ID signing with this team ID
// Validate it against code signing check of this archive
// CertificateIssuedByApple = anchor apple generic
// IssuerIsDeveloperID = certificate 1[field.1.2.840.113635.100.6.2.6]
// LeafIsDeveloperIDApp = certificate leaf[field.1.2.840.113635.100.6.1.13]
// DeveloperIDTeamID = certificate leaf[subject.OU]
// https://developer.apple.com/documentation/technotes/tn3127-inside-code-signing-requirements#Xcode-designated-requirement-for-Developer-ID-code
requirementString = [NSString stringWithFormat:@"anchor apple generic and certificate 1[field.1.2.840.113635.100.6.2.6] and certificate leaf[field.1.2.840.113635.100.6.1.13] and certificate leaf[subject.OU] = %@", teamIdentifier];
result = SecRequirementCreateWithString((__bridge CFStringRef)requirementString, kSecCSDefaultFlags, &requirement);
if (result != errSecSuccess) {
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"%@. The designated requirement string with a Developer ID requirement with team identifier '%@' could not be created with error %d", commonErrorMessage, teamIdentifier, result] }];
goto finally;
}
result = SecStaticCodeCreateWithPath((__bridge CFURLRef)downloadURL, kSecCSDefaultFlags, &downloadStaticCode);
if (result != errSecSuccess) {
NSString *message = [NSString stringWithFormat:@"%@. The static code could not be retrieved from the download archive with error %d. The download archive may not be Apple code signed.", commonErrorMessage, result];
SULog(SULogLevelError, @"%@", message);
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: message }];
goto finally;
}
SecCSFlags flags = (SecCSFlags)kSecCSDefaultFlags;
CFErrorRef cfError = NULL;
result = SecStaticCodeCheckValidityWithErrors(downloadStaticCode, flags, requirement, &cfError);
if (result != errSecSuccess) {
NSError *underlyingError;
if (cfError != NULL) {
NSError *tmpError = CFBridgingRelease(cfError);
underlyingError = tmpError;
} else {
underlyingError = nil;
}
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
if (underlyingError != nil) {
userInfo[NSUnderlyingErrorKey] = underlyingError;
}
if (result == errSecCSUnsigned) {
NSString *message = [NSString stringWithFormat:@"%@. The download archive is not Apple code signed.", commonErrorMessage];
SULog(SULogLevelError, @"%@", message);
userInfo[NSLocalizedDescriptionKey] = message;
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
} else if (result == errSecCSReqFailed) {
NSString *initialMessage = [NSString stringWithFormat:@"%@. The Apple code signature of new downloaded archive is either not Developer ID code signed, or doesn't have a Team ID that matches the old app version (%@). Please ensure that the archive and app are signed using the same Developer ID certificate.", commonErrorMessage, teamIdentifier];
NSDictionary *oldInfo = [self logSigningInfoForCode:oldStaticCode label:@"old info"];
NSDictionary *newInfo = [self logSigningInfoForCode:downloadStaticCode label:@"new info"];
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"%@ old info: %@. new info: %@", initialMessage, oldInfo, newInfo];
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
} else {
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"%@. The downloaded archive code signing signature failed to validate with an unknown error (%d).", commonErrorMessage, result];
resultError = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:[userInfo copy]];
}
goto finally;
}
finally:
if (oldStaticCode != NULL) {
CFRelease(oldStaticCode);
}
if (requirement != NULL) {
CFRelease(requirement);
}
if (downloadStaticCode != NULL) {
CFRelease(downloadStaticCode);
}
if (resultError != nil && error != NULL) {
*error = resultError;
}
return (resultError == nil);
}
+ (SUValidateConnectionStatus)validateConnection:(NSXPCConnection *)connection options:(SUValidateConnectionOptions)options error:(NSError * __autoreleasing *)error
{
NSMutableArray<NSString *> *codeSigningRequirementComponents = [NSMutableArray array];
// Build the default team ID signing requirement
NSString *hostTeamIdentifier = [self teamIdentifierFromMainExecutable];
if (hostTeamIdentifier != nil) {
NSString *teamIdentifierRequirement = [NSString stringWithFormat:@"(anchor apple generic and certificate leaf[subject.OU] = %@)", hostTeamIdentifier];
[codeSigningRequirementComponents addObject:teamIdentifierRequirement];
}
// Build the sandboxing requirement
if ((options & SUValidateConnectionOptionRequireSandboxEntitlement) != 0) {
// This ensures the entitlement is set to true too
NSString *sandboxingRequirement = @"(entitlement [\"com.apple.security.app-sandbox\"] exists)";
[codeSigningRequirementComponents addObject:sandboxingRequirement];
}
// Check if no requirement is required
if (codeSigningRequirementComponents.count == 0) {
return SUValidateConnectionStatusSetNoRequirementSuccess;
}
NSString *codeSigningRequirement = [codeSigningRequirementComponents componentsJoinedByString:@" and "];
if (@available(macOS 13.0, *)) {
[connection setCodeSigningRequirement:codeSigningRequirement];
return SUValidateConnectionStatusSetCodeSigningRequirementSuccess;
}
// Fall back to audit token on older OS's
if ([connection respondsToSelector:@selector(auditToken)]) {
audit_token_t auditToken = [connection auditToken];
NSData *auditTokenData = [NSData dataWithBytes:&auditToken length:sizeof(auditToken)];
NSDictionary *attributes = @{
(NSString *)kSecGuestAttributeAudit: auditTokenData
};
SecCodeRef code = NULL;
OSStatus result = SecCodeCopyGuestWithAttributes(NULL, (__bridge CFDictionaryRef _Nullable)(attributes), kSecCSDefaultFlags, &code);
if (result != errSecSuccess) {
CFRelease(code);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"The client connection could not be validated because SecCodeCopyGuestWithAttributes() failed with error %d", result] }];
}
return SUValidateConnectionStatusAPIFailure;
}
// Check if the client is code signed with our signing requirement
SecRequirementRef requirement = NULL;
result = SecRequirementCreateWithString((__bridge CFStringRef)codeSigningRequirement, kSecCSDefaultFlags, &requirement);
if (result != errSecSuccess) {
CFRelease(code);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"The client connection could not be validated because SecRequirementCreateWithString() failed with error %d", result] }];
}
return SUValidateConnectionStatusAPIFailure;
}
CFErrorRef cfError = NULL;
// This is not a static code, so we don't pass kSecCSCheckAllArchitectures
result = SecCodeCheckValidityWithErrors(code, kSecCSDefaultFlags, requirement, &cfError);
CFRelease(requirement);
requirement = NULL;
if (result != errSecSuccess) {
NSError *cfBridgedError = (NSError *)CFBridgingRelease(cfError);
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"The client connection could not be validated because validating the code signature failed with error %d (%@). Does the app meet the designated requirement: %@", result, cfBridgedError.localizedDescription, codeSigningRequirement] }];
}
[self logSigningInfoForCode:code label:@"Client"];
CFRelease(code);
return SUValidateConnectionStatusCodeSigningRequirementFailure;
}
CFRelease(code);
return SUValidateConnectionStatusSetCodeSigningRequirementSuccess;
}
// Not much we can do if auditToken is not supported. This code should not be reached though.
return SUValidateConectionNoSupportedValidationMethodFailure;
}
@end
+4
View File
@@ -6,6 +6,8 @@
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#if SPARKLE_BUILD_DMG_SUPPORT
#ifndef SUDISKIMAGEUNARCHIVER_H
#define SUDISKIMAGEUNARCHIVER_H
@@ -25,3 +27,5 @@ SPU_OBJC_DIRECT_MEMBERS @interface SUDiskImageUnarchiver : NSObject <SUUnarchive
NS_ASSUME_NONNULL_END
#endif
#endif
+5 -6
View File
@@ -6,6 +6,8 @@
// Copyright 2008 Andy Matuschak. All rights reserved.
//
#if SPARKLE_BUILD_DMG_SUPPORT
#import "SUDiskImageUnarchiver.h"
#import "SUUnarchiverNotifier.h"
#import "SULog.h"
@@ -33,7 +35,7 @@
return [[path pathExtension] isEqualToString:@"dmg"];
}
+ (BOOL)mustValidateBeforeExtraction
+ (BOOL)mustValidateBeforeExtractionWithArchivePath:(NSString *)archivePath
{
return NO;
}
@@ -49,11 +51,6 @@
return self;
}
- (BOOL)needsVerifyBeforeExtractionKey
{
return NO;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock waitForCleanup:(BOOL)waitForCleanup
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@@ -322,3 +319,5 @@ static NSUInteger fileCountForDirectory(NSFileManager *fileManager, NSString *it
- (NSString *)description { return [NSString stringWithFormat:@"%@ <%@>", [self class], _archivePath]; }
@end
#endif
+1 -6
View File
@@ -28,7 +28,7 @@
return [path.pathExtension isEqualToString:@"pkg"] || [path.pathExtension isEqualToString:@"mpkg"];
}
+ (BOOL)mustValidateBeforeExtraction
+ (BOOL)mustValidateBeforeExtractionWithArchivePath:(NSString *)archivePath
{
return YES;
}
@@ -44,11 +44,6 @@
return self;
}
- (BOOL)needsVerifyBeforeExtractionKey
{
return NO;
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock waitForCleanup:(BOOL)__unused waitForCleanup
{
SUUnarchiverNotifier *notifier = [[SUUnarchiverNotifier alloc] initWithCompletionBlock:completionBlock progressBlock:progressBlock];
+1 -1
View File
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SUInstaller : NSObject
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory connectionCodeSigningValidationSkipped:(BOOL)connectionCodeSigningValidationSkipped homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error;
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError **)error;
+ (nullable NSString *)installSourcePathInUpdateFolder:(NSString *)inUpdateFolder forHost:(SUHost *)host
#if SPARKLE_BUILD_PACKAGE_SUPPORT
+1 -78
View File
@@ -150,7 +150,7 @@
return newAppDownloadPath;
}
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory connectionCodeSigningValidationSkipped:(BOOL)connectionCodeSigningValidationSkipped homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error
+ (nullable id<SUInstallerProtocol>)installerForHost:(SUHost *)host expectedInstallationType:(NSString *)expectedInstallationType updateDirectory:(NSString *)updateDirectory homeDirectory:(NSString *)homeDirectory userName:(NSString *)userName error:(NSError * __autoreleasing *)error
{
#if SPARKLE_BUILD_PACKAGE_SUPPORT
BOOL isPackage = NO;
@@ -170,83 +170,6 @@
return nil;
}
#if SPARKLE_BUILD_PACKAGE_SUPPORT
if (isPackage && connectionCodeSigningValidationSkipped) {
// Package updates cannot update arbitrary bundles if code signing validation on the connection was skipped
// (This means our helper is not code signed with an Apple issued certificate).
// In this case, the main executable must be owned by root and the host must contain our installer tool
NSString *installerExecutablePath = NSBundle.mainBundle.executableURL.URLByResolvingSymlinksInPath.path;
if (installerExecutablePath == nil) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: @"The "@SPARKLE_RELAUNCH_TOOL_NAME" executable path failed to be retrieved, which is an internal error that shouldn't happen. Please try to update using a production build of your app." }];
}
return nil;
}
NSString *hostBundlePath = host.bundle.bundleURL.URLByResolvingSymlinksInPath.path;
if (hostBundlePath == nil) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: @"The host bundle path to update to be retrieved, which is an internal error that shouldn't happen. Please try to update using a production build of your app." }];
}
return nil;
}
NSError *attributesError = nil;
NSDictionary<NSFileAttributeKey, id> *fileAttributes = [NSFileManager.defaultManager attributesOfItemAtPath:installerExecutablePath error:&attributesError];
if (fileAttributes == nil) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: @"File attributes failed to be retrieved from the "@SPARKLE_RELAUNCH_TOOL_NAME" executable, which is an internal error that shouldn't happen. Please try to update using a production build of your app." }];
}
return nil;
}
NSNumber *installerOwnerID = fileAttributes[NSFileOwnerAccountID];
if (installerOwnerID == nil) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: @"File owner ID failed to be retrieved from the "@SPARKLE_RELAUNCH_TOOL_NAME" executable, which is an internal error that shouldn't happen. Please try to update using a production build of your app." }];
}
return nil;
}
// Check our helper is owned by root
if (![installerOwnerID isEqual:@(0)]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Due to security, updating apps with package installers is disabled when '%@' is not signed with the same Team ID as your app, and "@SPARKLE_RELAUNCH_TOOL_NAME" is not owned by root (this specific case) or not residing in '%@'. Please either test an exported & production build of your app, or for development, code sign your app and Sparkle's embedded helpers with the same team: https://sparkle-project.org/documentation/sandboxing#code-signing", installerExecutablePath, hostBundlePath] }];
}
return nil;
}
NSArray<NSString *> *installerExecutablePathComponents = installerExecutablePath.pathComponents;
NSArray<NSString *> *hostBundlePathComponents = hostBundlePath.pathComponents;
if (installerExecutablePathComponents.count <= hostBundlePathComponents.count) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Due to security, updating apps with package installers is disabled when '%@' is not signed with the same Team ID as your app, and "@SPARKLE_RELAUNCH_TOOL_NAME" is not owned by root or not residing in '%@' (this specific case). Please either test an exported & production build of your app, or for development, code sign your app and Sparkle's embedded helpers with the same team: https://sparkle-project.org/documentation/sandboxing#code-signing", installerExecutablePath, hostBundlePath] }];
}
return nil;
}
// Check out helper resides inside the host app to be updated
if (![[installerExecutablePathComponents subarrayWithRange:NSMakeRange(0, hostBundlePathComponents.count)] isEqualToArray:hostBundlePathComponents]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUMissingUpdateError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Due to security, updating apps with package installers is disabled when '%@' is not signed with the same Team ID as your app, and "@SPARKLE_RELAUNCH_TOOL_NAME" is not owned by root or not residing in '%@' (this specific case). Please either test an exported & production build of your app, or for development, code sign your app and Sparkle's embedded helpers with the same team: https://sparkle-project.org/documentation/sandboxing#code-signing", installerExecutablePath, hostBundlePath] }];
}
return nil;
}
}
#else
(void)connectionCodeSigningValidationSkipped;
#endif
// Make sure we find the type of installer that we were expecting to find
// We shouldn't implicitly trust the installation type fed into here from the appcast because the installation type helps us determine
// ahead of time whether or not this installer tool should be ran as root or not
+6 -11
View File
@@ -21,7 +21,7 @@
}
// pipingData == NO is only supported for zip archives
static NSArray<NSString *> * _Nullable argumentsConformingToTypeOfPath(NSString *path, BOOL pipingData, NSString * __autoreleasing *outCommand)
static NSArray<NSString *> * _Nullable _argumentsConformingToTypeOfPath(NSString *path, BOOL pipingData, NSString * __autoreleasing *outCommand)
{
NSArray <NSString *> *extractTGZ = @[@"/usr/bin/tar", @"-zxC"];
NSArray <NSString *> *extractTBZ = @[@"/usr/bin/tar", @"-jxC"];
@@ -78,12 +78,12 @@ static NSArray<NSString *> * _Nullable argumentsConformingToTypeOfPath(NSString
+ (BOOL)canUnarchivePath:(NSString *)path
{
return argumentsConformingToTypeOfPath(path, YES, NULL) != nil;
return _argumentsConformingToTypeOfPath(path, YES, NULL) != nil;
}
+ (BOOL)mustValidateBeforeExtraction
+ (BOOL)mustValidateBeforeExtractionWithArchivePath:(NSString *)archivePath
{
return NO;
return ([archivePath hasSuffix:@".aar"] || [archivePath hasSuffix:@".yaa"]);
}
- (instancetype)initWithArchivePath:(NSString *)archivePath extractionDirectory:(NSString *)extractionDirectory
@@ -96,15 +96,10 @@ static NSArray<NSString *> * _Nullable argumentsConformingToTypeOfPath(NSString
return self;
}
- (BOOL)needsVerifyBeforeExtractionKey
{
return ([_archivePath hasSuffix:@".aar"] || [_archivePath hasSuffix:@".yaa"]);
}
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock waitForCleanup:(BOOL)__unused waitForCleanup
{
NSString *command = nil;
NSArray<NSString *> *arguments = argumentsConformingToTypeOfPath(_archivePath, YES, &command);
NSArray<NSString *> *arguments = _argumentsConformingToTypeOfPath(_archivePath, YES, &command);
assert(arguments != nil);
assert(command != nil);
@@ -153,7 +148,7 @@ static NSArray<NSString *> * _Nullable argumentsConformingToTypeOfPath(NSString
[notifier notifyFailureWithError:extractError];
} else {
// The ditto command will be the same so no need to fetch it again
NSArray<NSString *> *nonPipingArguments = argumentsConformingToTypeOfPath(self->_archivePath, NO, NULL);
NSArray<NSString *> *nonPipingArguments = _argumentsConformingToTypeOfPath(self->_archivePath, NO, NULL);
assert(nonPipingArguments != nil);
NSError *nonPipingExtractError = nil;
+14 -8
View File
@@ -353,16 +353,22 @@
// If the update has a custom update security policy, the same team ID policy may not apply,
// so in that case we will also skip performing an atomic swap
updateHasCustomUpdateSecurityPolicy = updateHost.hasUpdateSecurityPolicy;
if (updateHasCustomUpdateSecurityPolicy) {
// We don't handle working around a custom update security policy
NSURL *mainExecutableURL = NSBundle.mainBundle.executableURL;
if (mainExecutableURL == nil) {
// This shouldn't happen
_canPerformSafeAtomicSwap = NO;
} else {
NSString *installerTeamIdentifier = [SUCodeSigningVerifier teamIdentifierFromMainExecutable];
NSString *bundleTeamIdentifier = [SUCodeSigningVerifier teamIdentifierAtURL:bundle.bundleURL];
// If bundleTeamIdentifier is nil, then the update isn't code signed so atomic swap is okay
_canPerformSafeAtomicSwap = (bundleTeamIdentifier == nil || (installerTeamIdentifier != nil && [installerTeamIdentifier isEqualToString:bundleTeamIdentifier]));
updateHasCustomUpdateSecurityPolicy = updateHost.hasUpdateSecurityPolicy;
if (updateHasCustomUpdateSecurityPolicy) {
// We don't handle working around a custom update security policy
_canPerformSafeAtomicSwap = NO;
} else {
NSString *installerTeamIdentifier = [SUCodeSigningVerifier teamIdentifierAtURL:mainExecutableURL];
NSString *bundleTeamIdentifier = [SUCodeSigningVerifier teamIdentifierAtURL:bundle.bundleURL];
// If bundleTeamIdentifier is nil, then the update isn't code signed so atomic swap is okay
_canPerformSafeAtomicSwap = (bundleTeamIdentifier == nil || (installerTeamIdentifier != nil && [installerTeamIdentifier isEqualToString:bundleTeamIdentifier]));
}
}
} else {
_canPerformSafeAtomicSwap = YES;
+2
View File
@@ -23,9 +23,11 @@
if ([SUPipedUnarchiver canUnarchivePath:path]) {
return [[SUPipedUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory];
}
#if SPARKLE_BUILD_DMG_SUPPORT
else if ([SUDiskImageUnarchiver canUnarchivePath:path]) {
return [[SUDiskImageUnarchiver alloc] initWithArchivePath:path extractionDirectory:extractionDirectory decryptionPassword:decryptionPassword];
}
#endif
else if ([SUBinaryDeltaUnarchiver canUnarchivePath:path]) {
assert(hostPath != nil);
NSString *nonNullHostPath = hostPath;
+1 -3
View File
@@ -12,12 +12,10 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SUUnarchiverProtocol <NSObject>
+ (BOOL)mustValidateBeforeExtraction;
+ (BOOL)mustValidateBeforeExtractionWithArchivePath:(NSString *)archivePath;
- (void)unarchiveWithCompletionBlock:(void (^)(NSError * _Nullable))completionBlock progressBlock:(void (^ _Nullable)(double))progressBlock waitForCleanup:(BOOL)waitForCleanup;
@property (nonatomic, readonly) BOOL needsVerifyBeforeExtractionKey;
- (NSString *)description;
@end
-50
View File
@@ -1,53 +1,3 @@
# 2.7.2
* Harden policy on what operations clients are allowed to take (#2763) (Zorg)
# 2.7.1
* Fix typo in NN localisation (#2694) (Sjur N Moshagen)
* Fix compiler warnings for Xcode 16.3 (#2709) (Zorg)
* Fix Sparkle not building when SPARKLE_COPY_LOCALIZATIONS=0 (#2707) (Zorg)
* Fix release notes constraints when compiled with macOS 26 SDK (#2730) (Zorg)
* Fix reserved identifier warnings for Xcode 26 (#2729) (Zorg)
# 2.7.0
* Unarchiver / validation improvements (Zorg)
* Remove old checksum verification checks for dmg archives to improve extraction speed (#2568) (Zorg)
* Skip extracting auxiliary files and improve extraction progress for disk images (#2569) (Zorg)
* Improve robustness around extracting dmg's with passwords (#2627, #2571) (Zorg)
* Randomize the download archive name the installer extracts/executes (#2584) (Zorg)
* Retry extracting zip file without piping if extraction fails to workaround bug prior to macOS 15 (#2616) (Zorg)
* Add opt-in SUVerifyUpdateBeforeExtraction option to force verification of updates before extraction (#2667) (Zorg)
* Add support for extracting Apple Archives (.aar files; requires SUVerifyUpdateBeforeExtraction, macOS 10.15+) (#2586, #2588, #2590) (Zorg)
* Don't allow removal of signing keys more strictly (#2647) (Zorg)
* Remove SPARKLE_BUILD_DMG_SUPPORT option (#2690) (Zorg)
* Add new BinaryDelta format (version 4) (Zorg)
* Preserve bundle creation date when creating and applying delta updates (#2583) (Zorg)
* Use faster crc32 hashes for binary delta version 4 (#2638) (Zorg)
* Make binary delta version 4 the default (#2668) (Zorg)
* Language / layout improvements
* Fix recovery error suggestion not shown when app is translocated or on read-only mount (#2689) (Zorg)
* Fix typo in Dutch localisation (#2642) (Eitot)
* Add baseline alignment to status text in SUStatus dialog (#2587) (Eitot)
* Make horizontal hugging priority required for status text field (#2614) (Zorg)
* Adjust the layout of anonymous system profile info to align better with the rest of the panel's UI (#2564) (Daniel Jalkut)
* Fix typo in Dutch localisation (#2642) (Eitot)
* Internationalize system profile display keys (#2577) (Zorg)
* Update hebrew locale and add right-to-left characters (#2573, #2576, #2578, #2579) (Shlomo)
* Update localisations for Dutch and German (#2582) (Eitot)
* Add unlocalized strings in Japanese (#2589) (1024jp)
* Fix typo in LICENSE (#2648) (fujisoft)
* Deprecate custom version comparators (#2639) (Zorg)
* Skip preflight update check in sparkle-cli if user is root (#2645) (Zorg)
* Avoid assert/crash when app is moved before update alert shows (#2658) (Zorg)
* Use default NSURLRequest timeoutInterval for the downloader (currently 60s) (#2673) (Zorg)
* Fix process substitution failing to work for providing the private key as file argument (#2615) (Zorg)
* Improve unable decode private key error messages in generate_appcast (#2675) (Zorg)
* Clarify that default channel must be in allowed channels set in API documentation (#2676) (Zorg)
* Call update permission prompt delegate method only when needed (#2622) (Zorg)
* Resolve duplicate class definitions from BinaryDelta, Sparkle Test App, and unit tests (#2570, #2629) (Zorg)
# 2.6.4
* Fix app modification prompt from appearing when downloaded update overrides NSUpdateSecurityPolicy (#2593)
+1 -1
View File
@@ -1 +1 @@
{"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz", "2.3.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.1/Sparkle-2.3.0-beta.1.tar.xz", "2.3.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.2/Sparkle-2.3.0-beta.2.tar.xz", "2.3.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0/Sparkle-2.3.0.tar.xz", "2.3.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.1/Sparkle-2.3.1.tar.xz", "2.3.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.2/Sparkle-2.3.2.tar.xz", "2.4.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.1/Sparkle-2.4.0-beta.1.tar.xz", "2.4.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.2/Sparkle-2.4.0-beta.2.tar.xz", "2.4.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0/Sparkle-2.4.0.tar.xz", "2.4.1-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1-beta.1/Sparkle-2.4.1-beta.1.tar.xz", "2.4.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1/Sparkle-2.4.1.tar.xz", "2.4.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz", "2.5.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.1/Sparkle-2.5.0-beta.1.tar.xz", "2.5.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.2/Sparkle-2.5.0-beta.2.tar.xz", "2.5.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0/Sparkle-2.5.0.tar.xz", "2.5.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.1/Sparkle-2.5.1.tar.xz", "2.5.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.2/Sparkle-2.5.2.tar.xz", "2.6.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.1/Sparkle-2.6.0-beta.1.tar.xz", "2.6.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.2/Sparkle-2.6.0-beta.2.tar.xz", "2.6.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0/Sparkle-2.6.0.tar.xz", "2.6.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.1/Sparkle-2.6.1.tar.xz", "1.27.2": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.2/Sparkle-1.27.2.tar.xz", "2.6.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.2/Sparkle-2.6.2.tar.xz", "1.27.3": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.3/Sparkle-1.27.3.tar.xz", "2.6.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.3/Sparkle-2.6.3.tar.xz", "2.6.4": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.4/Sparkle-2.6.4.tar.xz", "2.7.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.0-beta.1/Sparkle-2.7.0-beta.1.tar.xz", "2.7.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.0/Sparkle-2.7.0.tar.xz", "2.7.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.1/Sparkle-2.7.1.tar.xz", "2.7.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.7.2/Sparkle-2.7.2.tar.xz"}
{"1.27.1": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.1/Sparkle-1.27.1.tar.xz", "2.0.0-beta.6": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-beta.6/Sparkle-2.0.0-beta.6.tar.xz", "2.0.0-rc.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0-rc.1/Sparkle-2.0.0-rc.1.tar.xz", "2.0.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.0.0/Sparkle-2.0.0.tar.xz", "2.1.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.1/Sparkle-2.1.0-beta.1.tar.xz", "2.1.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0-beta.2/Sparkle-2.1.0-beta.2.tar.xz", "2.1.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.1.0/Sparkle-2.1.0.tar.xz", "2.2.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.1/Sparkle-2.2.0-beta.1.tar.xz", "2.2.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0-beta.2/Sparkle-2.2.0-beta.2.tar.xz", "2.2.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.0/Sparkle-2.2.0.tar.xz", "2.2.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.1/Sparkle-2.2.1.tar.xz", "2.2.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.2.2/Sparkle-2.2.2.tar.xz", "2.3.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.1/Sparkle-2.3.0-beta.1.tar.xz", "2.3.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0-beta.2/Sparkle-2.3.0-beta.2.tar.xz", "2.3.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.0/Sparkle-2.3.0.tar.xz", "2.3.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.1/Sparkle-2.3.1.tar.xz", "2.3.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.3.2/Sparkle-2.3.2.tar.xz", "2.4.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.1/Sparkle-2.4.0-beta.1.tar.xz", "2.4.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0-beta.2/Sparkle-2.4.0-beta.2.tar.xz", "2.4.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.0/Sparkle-2.4.0.tar.xz", "2.4.1-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1-beta.1/Sparkle-2.4.1-beta.1.tar.xz", "2.4.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.1/Sparkle-2.4.1.tar.xz", "2.4.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.4.2/Sparkle-2.4.2.tar.xz", "2.5.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.1/Sparkle-2.5.0-beta.1.tar.xz", "2.5.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0-beta.2/Sparkle-2.5.0-beta.2.tar.xz", "2.5.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.0/Sparkle-2.5.0.tar.xz", "2.5.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.1/Sparkle-2.5.1.tar.xz", "2.5.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.5.2/Sparkle-2.5.2.tar.xz", "2.6.0-beta.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.1/Sparkle-2.6.0-beta.1.tar.xz", "2.6.0-beta.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0-beta.2/Sparkle-2.6.0-beta.2.tar.xz", "2.6.0": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.0/Sparkle-2.6.0.tar.xz", "2.6.1": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.1/Sparkle-2.6.1.tar.xz", "1.27.2": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.2/Sparkle-1.27.2.tar.xz", "2.6.2": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.2/Sparkle-2.6.2.tar.xz", "1.27.3": "https://github.com/sparkle-project/Sparkle/releases/download/1.27.3/Sparkle-1.27.3.tar.xz", "2.6.3": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.3/Sparkle-2.6.3.tar.xz", "2.6.4": "https://github.com/sparkle-project/Sparkle/releases/download/2.6.4/Sparkle-2.6.4.tar.xz"}
+11 -6
View File
@@ -33,6 +33,10 @@ SPARKLE_BUILD_BZIP2_DELTA_SUPPORT = 1
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
SPARKLE_BUILD_PACKAGE_SUPPORT = 1
// Set to 0 to not build support for extracting updates from disk images (dmgs)
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
SPARKLE_BUILD_DMG_SUPPORT = 1
// Set to 0 to only build all non-UI bits (which means client uses a custom SPUUserDriver)
SPARKLE_BUILD_UI_BITS = 1
@@ -43,7 +47,8 @@ SPARKLE_COPY_LOCALIZATIONS = 1
// If SPARKLE_BUILD_LEGACY_DELTA_SUPPORT is set to 0, remove -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT
// If GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT is set to 0, remove -DGENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
// If SPARKLE_BUILD_PACKAGE_SUPPORT is set to 0, remove -DSPARKLE_BUILD_PACKAGE_SUPPORT
OTHER_SWIFT_FLAGS_COMMON = -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT -DGENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT -DSPARKLE_BUILD_PACKAGE_SUPPORT
// If SPARKLE_BUILD_DMG_SUPPORT is set to 0, remove -DSPARKLE_BUILD_DMG_SUPPORT
OTHER_SWIFT_FLAGS_COMMON = -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT -DGENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT -DSPARKLE_BUILD_PACKAGE_SUPPORT -DSPARKLE_BUILD_DMG_SUPPORT
// Minimum supported macOS version
MACOSX_DEPLOYMENT_TARGET = 10.13
@@ -94,12 +99,12 @@ SPARKLE_ICON_NAME = AppIcon
// These variables must have a space after the '=' too
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 7
SPARKLE_VERSION_PATCH = 2
SPARKLE_VERSION_PATCH = 0
// This should be in SemVer format or empty, ie. "-beta.1"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX =
CURRENT_PROJECT_VERSION = 2045.1
SPARKLE_VERSION_SUFFIX = -beta.1
CURRENT_PROJECT_VERSION = 2041
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO
@@ -109,7 +114,7 @@ GCC_INLINES_ARE_PRIVATE_EXTERN = YES
PRODUCT_NAME = ${TARGET_NAME}
PRODUCT_BUNDLE_IDENTIFIER = org.sparkle-project.Sparkle.${PRODUCT_NAME:rfc1034identifier}
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPU_OBJC_DIRECT=__attribute__((objc_direct)) SPU_OBJC_DIRECT_MEMBERS=__attribute__((objc_direct_members)) SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) SPARKLE_COPY_LOCALIZATIONS=$(SPARKLE_COPY_LOCALIZATIONS) SPARKLE_BUILD_LEGACY_SUUPDATER=$(SPARKLE_BUILD_LEGACY_SUUPDATER) SPARKLE_BUILD_PACKAGE_SUPPORT=$(SPARKLE_BUILD_PACKAGE_SUPPORT) SPARKLE_BUILD_LEGACY_DELTA_SUPPORT=$(SPARKLE_BUILD_LEGACY_DELTA_SUPPORT) SPARKLE_BUILD_BZIP2_DELTA_SUPPORT=$(SPARKLE_BUILD_BZIP2_DELTA_SUPPORT) SPARKLE_BUILD_LEGACY_DSA_SUPPORT=$(SPARKLE_BUILD_LEGACY_DSA_SUPPORT) GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT=$(GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_NAME=\"${INSTALLER_LAUNCHER_NAME}\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_LAUNCHER_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE) INSTALLER_CONNECTION_NAME=\"${INSTALLER_CONNECTION_NAME}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE) INSTALLER_STATUS_NAME=\"${INSTALLER_STATUS_NAME}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" INSTALLER_STATUS_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE) DOWNLOADER_NAME=\"${DOWNLOADER_NAME}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\" DOWNLOADER_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE)
GCC_PREPROCESSOR_DEFINITIONS_COMMON = SPU_OBJC_DIRECT=__attribute__((objc_direct)) SPU_OBJC_DIRECT_MEMBERS=__attribute__((objc_direct_members)) SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME=$(SPARKLE_NORMALIZE_INSTALLED_APPLICATION_NAME) SPARKLE_BUILD_UI_BITS=$(SPARKLE_BUILD_UI_BITS) SPARKLE_COPY_LOCALIZATIONS=$(SPARKLE_COPY_LOCALIZATIONS) SPARKLE_BUILD_LEGACY_SUUPDATER=$(SPARKLE_BUILD_LEGACY_SUUPDATER) SPARKLE_BUILD_PACKAGE_SUPPORT=$(SPARKLE_BUILD_PACKAGE_SUPPORT) SPARKLE_BUILD_DMG_SUPPORT=$(SPARKLE_BUILD_DMG_SUPPORT) SPARKLE_BUILD_LEGACY_DELTA_SUPPORT=$(SPARKLE_BUILD_LEGACY_DELTA_SUPPORT) SPARKLE_BUILD_BZIP2_DELTA_SUPPORT=$(SPARKLE_BUILD_BZIP2_DELTA_SUPPORT) SPARKLE_BUILD_LEGACY_DSA_SUPPORT=$(SPARKLE_BUILD_LEGACY_DSA_SUPPORT) GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT=$(GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT) SPARKLE_BUNDLE_IDENTIFIER=\"$(SPARKLE_BUNDLE_IDENTIFIER)\" CURRENT_PROJECT_VERSION=\"$(CURRENT_PROJECT_VERSION)\" MARKETING_VERSION=\"$(MARKETING_VERSION)\" SPARKLE_RELAUNCH_TOOL_NAME=\"$(SPARKLE_RELAUNCH_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_NAME=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_NAME)\" SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID=\"$(SPARKLE_INSTALLER_PROGRESS_TOOL_BUNDLE_ID)\" SPARKLE_ICON_NAME=\"$(SPARKLE_ICON_NAME)\" INSTALLER_LAUNCHER_NAME=\"${INSTALLER_LAUNCHER_NAME}\" INSTALLER_LAUNCHER_BUNDLE_ID=\"${INSTALLER_LAUNCHER_BUNDLE_ID}\" INSTALLER_LAUNCHER_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_LAUNCHER_XPC_SERVICE) INSTALLER_CONNECTION_NAME=\"${INSTALLER_CONNECTION_NAME}\" INSTALLER_CONNECTION_BUNDLE_ID=\"${INSTALLER_CONNECTION_BUNDLE_ID}\" INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE) INSTALLER_STATUS_NAME=\"${INSTALLER_STATUS_NAME}\" INSTALLER_STATUS_BUNDLE_ID=\"${INSTALLER_STATUS_BUNDLE_ID}\" INSTALLER_STATUS_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE) DOWNLOADER_NAME=\"${DOWNLOADER_NAME}\" DOWNLOADER_BUNDLE_ID=\"${DOWNLOADER_BUNDLE_ID}\" DOWNLOADER_XPC_SERVICE_EMBEDDED=$(SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE)
CODE_SIGN_IDENTITY = -
SDKROOT = macosx
@@ -164,4 +169,4 @@ GCC_WARN_UNUSED_PARAMETER = YES
GCC_WARN_UNUSED_VARIABLE = YES
// Turn on all warnings, then disable a few which are almost impossible to avoid
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso -Wno-direct-ivar-access -Wno-declaration-after-statement -Wno-gnu-conditional-omitted-operand -Wno-switch-default -Wno-missing-include-dirs -Werror=undef
WARNING_CFLAGS = -Wall -Weverything -Wno-unused-macros -Wno-gnu-statement-expression -Wno-auto-import -Wno-gnu-zero-variadic-macro-arguments -Wno-format-non-iso -Wno-direct-ivar-access -Wno-declaration-after-statement -Wno-gnu-conditional-omitted-operand -Werror=undef
+1 -1
View File
@@ -84,7 +84,7 @@ if [ "$ACTION" = "" ] ; then
find . \! -type d | rev | sort | rev | tar --no-xattrs -cJvf "../Sparkle-$MARKETING_VERSION.tar.xz" --files-from=-
# Copy archived distribution for CI
cp -f "../Sparkle-$MARKETING_VERSION.tar.xz" "../sparkle_dist.tar.xz"
cp -f "../Sparkle-$MARKETING_VERSION.tar.xz" "../sparkle-dist.tar.xz"
# Extract archive for testing binary validity
tar -xf "../Sparkle-$MARKETING_VERSION.tar.xz" -C "/tmp/sparkle-extract"
+7 -37
View File
@@ -55,32 +55,6 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (void)startDownloadWithRequest:(NSURLRequest *)request SPU_OBJC_DIRECT
{
if (request == nil) {
NSString *message = @"The download request must not be nil";
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: message }];
[_delegate downloaderDidFailWithError:error];
return;
}
// Prevent any unwanted URL schemes (e.g. file://)
NSString *scheme = request.URL.scheme;
if (scheme == nil) {
NSString *message = @"The download request scheme must not be nil";
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: message }];
[_delegate downloaderDidFailWithError:error];
return;
}
if ([scheme caseInsensitiveCompare:@"http"] != NSOrderedSame && [scheme caseInsensitiveCompare:@"https"] != NSOrderedSame) {
NSString *message = [NSString stringWithFormat:@"The download request URL must use http or https (%@)", request.URL];
NSError *error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUDownloadError userInfo:@{ NSLocalizedDescriptionKey: message }];
[_delegate downloaderDidFailWithError:error];
return;
}
_downloadSession = [NSURLSession
sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]
delegate:self
@@ -143,14 +117,12 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
// The downloader instance that creates this temp directory isn't necessarily the same as the one
// that clears it (eg upon skipping an already downloaded update), so we can't just preserve it here too
dispatch_async(dispatch_get_main_queue(), ^{
if (bundleIdentifier != nil && downloadToken != nil) {
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:bundleIdentifier];
if (rootPersistentDownloadCachePath != nil) {
NSString *sanitizedDownloadToken = downloadToken.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDownloadToken];
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:NULL];
}
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:bundleIdentifier];
if (rootPersistentDownloadCachePath != nil) {
NSString *sanitizedDownloadToken = downloadToken.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDownloadToken];
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:NULL];
}
});
}
@@ -176,9 +148,7 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
dispatch_async(dispatch_get_main_queue(), ^{
[self _cleanup];
if (completionHandler != NULL) {
completionHandler();
}
completionHandler();
});
}
-25
View File
@@ -9,8 +9,6 @@
#import <Foundation/Foundation.h>
#import "SPUDownloader.h"
#import "SPUDownloaderDelegate.h"
#import "SULog.h"
#import "SUCodeSigningVerifier.h"
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
@end
@@ -20,29 +18,6 @@
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
// Validate connection of clients to avoid any client from using the service.
// Ideally we would also prevent clients connecting that have an outgoing network connection enabled,
// but this is not easy to enforce.
// This is a policy, not a security critical enforcement.
{
NSError *validationError = nil;
SUValidateConnectionStatus validationStatus = [SUCodeSigningVerifier validateConnection:newConnection options:SUValidateConnectionOptionDefault error:&validationError];
switch (validationStatus) {
case SUValidateConnectionStatusSetCodeSigningRequirementSuccess:
break;
case SUValidateConnectionStatusSetNoRequirementSuccess:
break;
case SUValidateConnectionStatusAPIFailure:
case SUValidateConnectionStatusCodeSigningRequirementFailure:
case SUValidateConectionNoSupportedValidationMethodFailure:
SULog(SULogLevelError, @"Error: Downloader XPC Service is rejecting new connection due to failing validation of XPC connection with status %lu and error: %@", validationStatus, validationError.localizedDescription);
[newConnection invalidate];
return NO;
}
}
// Configure the connection.
// First, set the interface that the exported object implements.
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SPUDownloaderProtocol)];
+3 -43
View File
@@ -106,7 +106,7 @@
return (submittedJob == true);
}
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier userName:(NSString *)userName homeDirectory:(NSString *)homeDirectory mainBundleName:(NSString *)mainBundleName inSystemDomain:(BOOL)systemDomain rootUser:(BOOL)rootUser SPU_OBJC_DIRECT
- (SUInstallerLauncherStatus)submitInstallerAtPath:(NSString *)installerPath withHostBundle:(NSBundle *)hostBundle updaterIdentifier:(NSString *)updaterIdentifier userName:(NSString *)userName homeDirectory:(NSString *)homeDirectory authorizationPrompt:(NSString *)authorizationPrompt inSystemDomain:(BOOL)systemDomain rootUser:(BOOL)rootUser SPU_OBJC_DIRECT
{
SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -140,25 +140,14 @@
// Using this right rather than using something like kSMRightModifySystemDaemons allows us to present a better worded prompt
// Note the right name is cached, so if we want to change the authorization
// prompt, we may need to change the right name. I have found no good way around this :|
SUHost *host = [[SUHost alloc] initWithBundle:hostBundle];
NSString *hostName = host.name;
// Figure out the authorization prompt and right name
// We create the authorization prompt here so that a bad client cannot pass in a completely arbitrary prompt message
// We also forgo localization for this prompt at the moment because with the right name being cached, updating localizations will be undesirable.
// Furthermore, we can avoid adding localization files to the Installer XPC Service (if that one is being used).
NSString *sparkleAuthTag = @"sparkle2-auth"; // this needs to change if auth wording changes
NSString *rightNameString;
NSString *authorizationPrompt;
if ([hostBundleIdentifier isEqualToString:updaterIdentifier]) {
// Application bundle is likely updating itself
rightNameString = [NSString stringWithFormat:@"%@.%@", hostBundleIdentifier, sparkleAuthTag];
authorizationPrompt = [NSString stringWithFormat:@"%1$@ wants permission to update.", hostName];
} else {
// Updater is likely updating a bundle that is not itself
rightNameString = [NSString stringWithFormat:@"%@.%@.%@", updaterIdentifier, hostBundleIdentifier, sparkleAuthTag];
authorizationPrompt = [NSString stringWithFormat:@"%1$@ wants permission to update %2$@.", mainBundleName, hostName];
}
const char *rightName = rightNameString.UTF8String;
@@ -414,38 +403,9 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
}
// Note: do not pass untrusted information such as paths to the installer and progress agent tools, when we can find them ourselves here
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier mainBundleName:(NSString *)mainBundleName installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler
{
dispatch_async(dispatch_get_main_queue(), ^{
if (completionHandler == NULL) {
SULog(SULogLevelError, @"Error: Failed to retrieve completionHandler (nil)");
return;
}
if (hostBundlePath == nil) {
SULog(SULogLevelError, @"Error: Failed to retrieve hostBundlePath (nil)");
completionHandler(SUInstallerLauncherFailure, NO);
return;
}
if (updaterIdentifier == nil) {
SULog(SULogLevelError, @"Error: Failed to retrieve updaterIdentifier (nil)");
completionHandler(SUInstallerLauncherFailure, NO);
return;
}
if (mainBundleName == nil) {
SULog(SULogLevelError, @"Error: Failed to retrieve mainBundleName (nil)");
completionHandler(SUInstallerLauncherFailure, NO);
return;
}
if (installationType == nil) {
SULog(SULogLevelError, @"Error: Failed to retrieve installationType (nil)");
completionHandler(SUInstallerLauncherFailure, NO);
return;
}
// We could do a sort of preflight Authorization test instead of testing if we are running as root,
// but I think this is not necessarily a better approach. We have to chown() the launcher cache directory later on,
// and that is not necessarily related to a preflight test. It's more related to being ran under a root / different user from the active GUI session
@@ -575,7 +535,7 @@ static BOOL SPUUsesSystemDomainForBundlePath(NSString *path, BOOL rootUser
return;
}
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle updaterIdentifier:updaterIdentifier userName:userName homeDirectory:homeDirectory mainBundleName:mainBundleName inSystemDomain:inSystemDomain rootUser:rootUser];
SUInstallerLauncherStatus installerStatus = [self submitInstallerAtPath:installerPath withHostBundle:hostBundle updaterIdentifier:updaterIdentifier userName:userName homeDirectory:homeDirectory authorizationPrompt:authorizationPrompt inSystemDomain:inSystemDomain rootUser:rootUser];
BOOL submittedProgressTool = NO;
if (installerStatus == SUInstallerLauncherSuccess) {
@@ -11,6 +11,6 @@
@protocol SUInstallerLauncherProtocol
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier mainBundleName:(NSString *)mainBundleName installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
- (void)launchInstallerWithHostBundlePath:(NSString *)hostBundlePath updaterIdentifier:(NSString *)updaterBundleIdentifier authorizationPrompt:(NSString *)authorizationPrompt installationType:(NSString *)installationType allowingDriverInteraction:(BOOL)allowingDriverInteraction completion:(void (^)(SUInstallerLauncherStatus, BOOL))completionHandler;
@end
-23
View File
@@ -8,8 +8,6 @@
#import <Foundation/Foundation.h>
#import "SUInstallerLauncher.h"
#import "SULog.h"
#import "SUCodeSigningVerifier.h"
@interface ServiceDelegate : NSObject <NSXPCListenerDelegate>
@end
@@ -19,27 +17,6 @@
- (BOOL)listener:(NSXPCListener *)__unused listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection {
// This method is where the NSXPCListener configures, accepts, and resumes a new incoming NSXPCConnection.
// Validate connection of clients to avoid any client from using the service.
// This is a policy, not a security critical enforcement.
{
NSError *validationError = nil;
SUValidateConnectionStatus validationStatus = [SUCodeSigningVerifier validateConnection:newConnection options: SUValidateConnectionOptionDefault error:&validationError];
switch (validationStatus) {
case SUValidateConnectionStatusSetCodeSigningRequirementSuccess:
break;
case SUValidateConnectionStatusSetNoRequirementSuccess:
break;
case SUValidateConnectionStatusAPIFailure:
case SUValidateConnectionStatusCodeSigningRequirementFailure:
case SUValidateConectionNoSupportedValidationMethodFailure:
SULog(SULogLevelError, @"Error: Installer XPC Service is rejecting new connection due to failing validation of XPC connection with status %lu and error: %@", validationStatus, validationError.localizedDescription);
[newConnection invalidate];
return NO;
}
}
// Configure the connection.
// First, set the interface that the exported object implements.
newConnection.exportedInterface = [NSXPCInterface interfaceWithProtocol:@protocol(SUInstallerLauncherProtocol)];
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "2.7.2"
let version = "2.6.4"
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
let tag = "2.7.2"
let checksum = "653753c3fa47e1652ade6fcf33c868c67b7b1fcd9469e2747ed63d63c85bd2b7"
let tag = "2.6.4"
let checksum = "eb3814726816ca2f09334ce562fff1b2cd0f7c16dd4e283256081f307accb9c4"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package(
+1 -1
View File
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "Sparkle"
s.version = "2.7.2"
s.version = "2.6.4"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for macOS."
s.homepage = "https://sparkle-project.org"
+5 -15
View File
@@ -223,7 +223,7 @@
724BB3AA1D3347C2005D534A /* SUInstallerStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 724BB3971D333832005D534A /* SUInstallerStatus.m */; };
724BB3B71D35ABA8005D534A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
724F76F91D6EAD0D00ECD062 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 525A278F133D6AE900FD8D70 /* Cocoa.framework */; };
725453552C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files_adhoc.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 725453542C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files_adhoc.dmg */; };
725453552C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 725453542C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files.dmg */; };
725602D51C83551C00DAA70E /* SUApplicationInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 725602D31C83551C00DAA70E /* SUApplicationInfo.h */; };
725602D61C83551C00DAA70E /* SUApplicationInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 725602D41C83551C00DAA70E /* SUApplicationInfo.m */; };
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */ = {isa = PBXBuildFile; fileRef = 725B3A81263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml */; };
@@ -314,7 +314,6 @@
7269E496264798200088C213 /* SPUSkippedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7269E493264798200088C213 /* SPUSkippedUpdate.m */; };
7269E4982648D3460088C213 /* SPUSkippedUpdate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7269E493264798200088C213 /* SPUSkippedUpdate.m */; };
7269E49A2648F7C00088C213 /* SPUUserUpdateState.m in Sources */ = {isa = PBXBuildFile; fileRef = 7269E4992648F7C00088C213 /* SPUUserUpdateState.m */; };
726B20612CF4F1D300E6F7DB /* DevSignedAppVersion2.dmg in Resources */ = {isa = PBXBuildFile; fileRef = 726B20602CF4F1D300E6F7DB /* DevSignedAppVersion2.dmg */; };
726DF88E1C84277600188804 /* SPUUserUpdateState.h in Headers */ = {isa = PBXBuildFile; fileRef = 726DF88D1C84277500188804 /* SPUUserUpdateState.h */; settings = {ATTRIBUTES = (Public, ); }; };
726E075C1CA3A6D6001A286B /* SPUSecureCoding.h in Headers */ = {isa = PBXBuildFile; fileRef = 726E075A1CA3A6D6001A286B /* SPUSecureCoding.h */; };
726E075D1CA3A6D6001A286B /* SPUSecureCoding.m in Sources */ = {isa = PBXBuildFile; fileRef = 726E075B1CA3A6D6001A286B /* SPUSecureCoding.m */; };
@@ -354,9 +353,6 @@
728ED34C277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
728ED34D277DA23400D9238F /* SPUSparkleDeltaArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 728ED349277DA23400D9238F /* SPUSparkleDeltaArchive.m */; };
729051E41DC82AC0003DEA7F /* SUOperatingSystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 726F2CE41BC9C33D001971A4 /* SUOperatingSystem.m */; };
7290BF2F2E5A5AFA00D75022 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
7290BF302E5A5B0F00D75022 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
7290BF312E5A5B2F00D75022 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61B5F8F609C4CEB300B25A18 /* Security.framework */; };
729743AB279D1BD2009910B2 /* SUCodeSigningVerifier.m in Sources */ = {isa = PBXBuildFile; fileRef = 7267E5991D3D8A5A00D1BF90 /* SUCodeSigningVerifier.m */; };
729924941DF4A45000DBCDF5 /* SUUpdateValidator.m in Sources */ = {isa = PBXBuildFile; fileRef = 729924931DF4A45000DBCDF5 /* SUUpdateValidator.m */; };
729F7EAC27366353004592DC /* test-links.xml in Resources */ = {isa = PBXBuildFile; fileRef = 729F7EAB27366353004592DC /* test-links.xml */; };
@@ -1234,7 +1230,7 @@
724BB3A61D33461B005D534A /* SUXPCInstallerStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUXPCInstallerStatus.h; sourceTree = "<group>"; };
724BB3A71D33461B005D534A /* SUXPCInstallerStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUXPCInstallerStatus.m; sourceTree = "<group>"; };
724BB3B51D35AAC3005D534A /* ServiceManagement.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ServiceManagement.framework; path = System/Library/Frameworks/ServiceManagement.framework; sourceTree = SDKROOT; };
725453542C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files_adhoc.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSign_apfs_lzma_aux_files_adhoc.dmg; sourceTree = "<group>"; };
725453542C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = SparkleTestCodeSign_apfs_lzma_aux_files.dmg; sourceTree = "<group>"; };
725602D31C83551C00DAA70E /* SUApplicationInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SUApplicationInfo.h; sourceTree = "<group>"; };
725602D41C83551C00DAA70E /* SUApplicationInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUApplicationInfo.m; sourceTree = "<group>"; };
72563CA9272E1C5400AF39F0 /* .github */ = {isa = PBXFileReference; lastKnownFileType = folder; path = .github; sourceTree = "<group>"; };
@@ -1310,7 +1306,6 @@
7269E493264798200088C213 /* SPUSkippedUpdate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPUSkippedUpdate.m; sourceTree = "<group>"; };
7269E4992648F7C00088C213 /* SPUUserUpdateState.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SPUUserUpdateState.m; sourceTree = "<group>"; };
7269E49C2648FC6C0088C213 /* SPUUserUpdateState+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SPUUserUpdateState+Private.h"; sourceTree = "<group>"; };
726B20602CF4F1D300E6F7DB /* DevSignedAppVersion2.dmg */ = {isa = PBXFileReference; lastKnownFileType = file; path = DevSignedAppVersion2.dmg; sourceTree = "<group>"; };
726B2B5D1C645FC900388755 /* UI Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UI Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
726DF88D1C84277500188804 /* SPUUserUpdateState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPUUserUpdateState.h; sourceTree = "<group>"; };
726E075A1CA3A6D6001A286B /* SPUSecureCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SPUSecureCoding.h; path = Sparkle/SPUSecureCoding.h; sourceTree = SOURCE_ROOT; };
@@ -1625,7 +1620,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
7290BF312E5A5B2F00D75022 /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -1873,7 +1867,7 @@
72E6D9722C0526DC005496E4 /* SparkleTestCodeSignApp.enc.nolicense.dmg */,
72AC6B271B9AAD6700F62325 /* SparkleTestCodeSignApp.tar */,
72BC6C3C275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg */,
725453542C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files_adhoc.dmg */,
725453542C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files.dmg */,
72E6D9702C04DE19005496E4 /* SparkleTestCodeSign_pkg.dmg */,
72AC6B291B9AAF3A00F62325 /* SparkleTestCodeSignApp.tar.bz2 */,
72AC6B251B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz */,
@@ -1885,7 +1879,6 @@
726FC0372C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar */,
72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */,
72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */,
726B20602CF4F1D300E6F7DB /* DevSignedAppVersion2.dmg */,
14958C6C19AEBC610061B14F /* test-pubkey.pem */,
5AF6C74E1AEA46D10014A3AB /* test.pkg */,
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
@@ -3020,7 +3013,7 @@
attributes = {
CLASSPREFIX = SU;
LastSwiftUpdateCheck = 1020;
LastUpgradeCheck = 1630;
LastUpgradeCheck = 1400;
ORGANIZATIONNAME = "Sparkle Project";
TargetAttributes = {
5D06E8CF0FD68C7C005AE3F6 = {
@@ -3199,7 +3192,7 @@
72AC6B261B9AAC8800F62325 /* SparkleTestCodeSignApp.tar.gz in Resources */,
72AC6B2C1B9AB0EE00F62325 /* SparkleTestCodeSignApp.tar.xz in Resources */,
729F7ECE27409077004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip in Resources */,
725453552C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files_adhoc.dmg in Resources */,
725453552C04DB3700362123 /* SparkleTestCodeSign_apfs_lzma_aux_files.dmg in Resources */,
5A5DD41D249F116E0045EB3E /* test-relative-urls.xml in Resources */,
F8761EB31ADC50EB000C9034 /* SparkleTestCodeSignApp.zip in Resources */,
5A5DD40424958B000045EB3E /* SUUpdateValidatorTest in Resources */,
@@ -3208,7 +3201,6 @@
72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */,
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
726FC0382C1E96AA00177986 /* SparkleTestCodeSignApp.enc.aar in Resources */,
726B20612CF4F1D300E6F7DB /* DevSignedAppVersion2.dmg in Resources */,
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */,
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
FA30773D24CBC295007BA37D /* testlocalizedreleasenotesappcast.xml in Resources */,
@@ -3545,7 +3537,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7290BF302E5A5B0F00D75022 /* SUCodeSigningVerifier.m in Sources */,
72464F7E1E21ED8C00FB341C /* SUHost.m in Sources */,
726E07B41CAF08D6001A286B /* main.m in Sources */,
721D8A7B1D4963190032E472 /* SPULocalCacheDirectory.m in Sources */,
@@ -3563,7 +3554,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
7290BF2F2E5A5AFA00D75022 /* SUCodeSigningVerifier.m in Sources */,
723B5DA71CF7AB0100365F95 /* main.m in Sources */,
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */,
723B5DA91CF7AB0100365F95 /* SPUDownloader.m in Sources */,
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1630"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
+26 -22
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="24093.7" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="24093.7"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -25,11 +25,11 @@
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<windowPositionMask key="initialPositionMask" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="746" y="229" width="620" height="370"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1409"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="875"/>
<value key="minSize" type="size" width="550" height="150"/>
<view key="contentView" id="6">
<rect key="frame" x="0.0" y="0.0" width="620" height="370"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="7" userLabel="Program icon">
<rect key="frame" x="22" y="286" width="64" height="64"/>
@@ -43,7 +43,7 @@
<binding destination="-2" name="value" keyPath="applicationIcon" id="9"/>
</connections>
</imageView>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="10" userLabel="Version text field">
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="10" userLabel="Version text field">
<rect key="frame" x="106" y="338" width="494" height="17"/>
<constraints>
<constraint firstAttribute="height" priority="777" constant="17" id="n8w-DR-XEM"/>
@@ -57,7 +57,7 @@
<binding destination="-2" name="value" keyPath="titleText" id="11"/>
</connections>
</textField>
<textField focusRingType="none" horizontalHuggingPriority="350" verticalHuggingPriority="999" horizontalCompressionResistancePriority="100" verticalCompressionResistancePriority="1000" preferredMaxLayoutWidth="490" translatesAutoresizingMaskIntoConstraints="NO" id="101" userLabel="Question text field">
<textField horizontalHuggingPriority="350" verticalHuggingPriority="999" horizontalCompressionResistancePriority="100" verticalCompressionResistancePriority="1000" preferredMaxLayoutWidth="490" translatesAutoresizingMaskIntoConstraints="NO" id="101" userLabel="Question text field">
<rect key="frame" x="106" y="316" width="494" height="14"/>
<constraints>
<constraint firstAttribute="height" relation="lessThanOrEqual" priority="300" constant="28" id="H6E-te-Fog"/>
@@ -73,12 +73,12 @@
</connections>
</textField>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="fKC-QA-GZa" userLabel="Container to hide release notes">
<rect key="frame" x="108" y="77" width="492" height="231"/>
<rect key="frame" x="108" y="73" width="492" height="235"/>
<subviews>
<box boxType="oldStyle" borderType="line" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="89">
<rect key="frame" x="0.0" y="0.0" width="492" height="211"/>
<rect key="frame" x="0.0" y="0.0" width="492" height="215"/>
<view key="contentView" id="hbB-V1-Bf6">
<rect key="frame" x="1" y="1" width="490" height="209"/>
<rect key="frame" x="1" y="1" width="490" height="213"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<constraints>
@@ -93,8 +93,8 @@
</binding>
</connections>
</box>
<textField focusRingType="none" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="17">
<rect key="frame" x="-2" y="217" width="88" height="14"/>
<textField verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="17">
<rect key="frame" x="-2" y="221" width="88" height="14"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="100" constant="100" id="gkn-FW-9aC"/>
</constraints>
@@ -123,7 +123,10 @@
</constraints>
</customView>
<button horizontalHuggingPriority="150" verticalHuggingPriority="750" horizontalCompressionResistancePriority="997" translatesAutoresizingMaskIntoConstraints="NO" id="22">
<rect key="frame" x="342" y="19" width="126" height="24"/>
<rect key="frame" x="338" y="12" width="137" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="90" id="2Zy-5G-GBj"/>
</constraints>
<buttonCell key="cell" type="push" title="Remind Me Later" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="171">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -136,7 +139,7 @@ Gw
</connections>
</button>
<button verticalHuggingPriority="750" horizontalCompressionResistancePriority="998" translatesAutoresizingMaskIntoConstraints="NO" id="23">
<rect key="frame" x="109" y="19" width="129" height="24"/>
<rect key="frame" x="102" y="12" width="139" height="32"/>
<buttonCell key="cell" type="push" title="Skip This Version" bezelStyle="rounded" alignment="center" borderStyle="border" inset="2" id="172">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -146,7 +149,10 @@ Gw
</connections>
</button>
<button horizontalHuggingPriority="20" verticalHuggingPriority="750" horizontalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="76">
<rect key="frame" x="480" y="19" width="120" height="24"/>
<rect key="frame" x="473" y="12" width="134" height="32"/>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="120" id="N94-uf-6oP"/>
</constraints>
<buttonCell key="cell" type="push" title="Install Update" bezelStyle="rounded" alignment="center" state="on" borderStyle="border" inset="2" id="173">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
@@ -154,23 +160,20 @@ Gw
DQ
</string>
</buttonCell>
<constraints>
<constraint firstAttribute="width" relation="greaterThanOrEqual" priority="222" constant="120" id="N94-uf-6oP"/>
</constraints>
<connections>
<action selector="installUpdate:" target="-2" id="77"/>
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="117">
<rect key="frame" x="109" y="55" width="313" height="14"/>
<buttonCell key="cell" type="check" title="Automatically download and install updates in the future" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="175">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<rect key="frame" x="108" y="50" width="491" height="16"/>
<constraints>
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="28" id="0AI-ue-a0r"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="14" id="yM1-TA-HfP"/>
</constraints>
<buttonCell key="cell" type="check" title="Automatically download and install updates in the future" bezelStyle="regularSquare" imagePosition="left" alignment="left" controlSize="small" inset="2" id="175">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="smallSystem"/>
</buttonCell>
<connections>
<binding destination="93" name="value" keyPath="values.SUAutomaticallyUpdate" id="135"/>
</connections>
@@ -201,6 +204,7 @@ DQ
<constraint firstItem="fKC-QA-GZa" firstAttribute="leading" secondItem="10" secondAttribute="leading" id="qQ9-OJ-06z"/>
<constraint firstItem="101" firstAttribute="top" secondItem="10" secondAttribute="bottom" constant="8" id="r7Q-z5-jkx"/>
<constraint firstItem="10" firstAttribute="top" secondItem="6" secondAttribute="top" constant="15" id="rXd-o0-WQQ"/>
<constraint firstAttribute="trailing" secondItem="117" secondAttribute="trailing" constant="21" id="sHI-Hm-eSA"/>
<constraint firstItem="7" firstAttribute="leading" secondItem="6" secondAttribute="leading" constant="22" id="zSE-lw-Ggj"/>
</constraints>
</view>
+1 -1
View File
@@ -14,7 +14,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ can’t be updated if it’s running from the location it was downloaded to.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ can’t be updated because it was opened from a read-only or a temporary location.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ can’t be updated, because it was opened from a read-only or a temporary location.";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ is currently the newest version available.";
+2 -6
View File
@@ -291,9 +291,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
NSRunningApplication *firstRunningApplication = runningApplications.firstObject;
BOOL targetDead = (firstRunningApplication == nil || firstRunningApplication.terminated);
if (reply != NULL) {
reply(targetDead);
}
reply(targetDead);
self->_repliedToRegistration = YES;
self->_applicationBundle = applicationBundle;
@@ -331,9 +329,7 @@ static const NSTimeInterval SUTerminationTimeDelay = 0.3;
#endif
if (self->_targetRunningApplication != nil && self->_terminationCompletionHandler == nil) {
if (self->_targetRunningApplication.terminated) {
if (completionHandler != NULL) {
completionHandler();
}
completionHandler();
} else {
self->_terminationCompletionHandler = [completionHandler copy];
+1 -1
View File
@@ -77,7 +77,7 @@
if ([_host isRunningTranslocated]) {
[delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningTranslocated userInfo:@{ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"Quit %1$@, move it into your Applications folder, relaunch it from there and try again.", SPARKLE_TABLE, sparkleBundle, nil), hostName], NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"%1$@ can’t be updated if it’s running from the location it was downloaded to.", SPARKLE_TABLE, sparkleBundle, nil), hostName], }]];
} else {
[delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"%1$@ can’t be updated because it was opened from a read-only or a temporary location.", SPARKLE_TABLE, sparkleBundle, nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", SPARKLE_TABLE, sparkleBundle, nil), hostName] }]];
[delegate basicDriverIsRequestingAbortUpdateWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SURunningFromDiskImageError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"%1$@ can’t be updated, because it was opened from a read-only or a temporary location.", SPARKLE_TABLE, sparkleBundle, nil), hostName], NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:SULocalizedStringFromTableInBundle(@"Use Finder to copy %1$@ to the Applications folder, relaunch it from there, and try again.", SPARKLE_TABLE, sparkleBundle, nil), hostName] }]];
}
} else {
[_appcastDriver loadAppcastFromURL:appcastURL userAgent:userAgent httpHeaders:httpHeaders inBackground:background];
+13 -5
View File
@@ -81,9 +81,7 @@
if (strongSelf != nil && !strongSelf->_retrievedDownloadResult && !strongSelf->_cleaningUp) {
strongSelf->_downloader = nil;
// We can't enforce com.apple.security.network.client == NO or it being absent for sandboxed clients,
// but we should warn about it anyway
SULog(SULogLevelError, @"Error: Connection to update downloader was invalidated. If your app is not sandboxed or has com.apple.security.network.client set to YES, please remove %@ from your Info.plist. Otherwise please check Console logs for "@DOWNLOADER_NAME" if there are any additional details.", SUEnableDownloaderServiceKey);
SULog(SULogLevelError, @"Connection to update downloader was invalidated");
NSDictionary *userInfo =
@{
@@ -114,8 +112,18 @@
_delegate = delegate;
_inBackground = background;
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL];
request.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData;
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
NSString *customTimeout = processInfo.environment[@"SPARKLE_TIMEOUT"];
NSTimeInterval timeout;
if (customTimeout != nil) {
timeout = customTimeout.doubleValue;
} else {
timeout = 60.0;
}
NSLog(@"SPARKLE_TIMEOUT: %f", timeout);
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:requestURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:timeout];
if (userAgent != nil) {
[request setValue:(NSString * _Nonnull)userAgent forHTTPHeaderField:@"User-Agent"];
+25 -11
View File
@@ -167,16 +167,13 @@
NSString *hostBundleIdentifier = _host.bundle.bundleIdentifier;
assert(hostBundleIdentifier != nil);
BOOL usingInstallerService;
#if INSTALLER_CONNECTION_XPC_SERVICE_EMBEDDED
if (SPUXPCServiceIsEnabled(SUEnableInstallerConnectionServiceKey)) {
_installerConnection = [[SUXPCInstallerConnection alloc] initWithDelegate:self];
usingInstallerService = YES;
} else
#endif
{
_installerConnection = [[SUInstallerConnection alloc] initWithDelegate:self remote:NO];
usingInstallerService = NO;
}
__weak __typeof__(self) weakSelf = self;
@@ -184,11 +181,9 @@
dispatch_async(dispatch_get_main_queue(), ^{
__typeof__(self) strongSelf = weakSelf;
if (strongSelf != nil && strongSelf->_installerConnection != nil && !strongSelf->_aborted) {
NSString *impactedTools = usingInstallerService ? (@SPARKLE_RELAUNCH_TOOL_NAME" and "@INSTALLER_LAUNCHER_NAME) : @SPARKLE_RELAUNCH_TOOL_NAME;
NSDictionary *genericUserInfo = @{
NSLocalizedDescriptionKey: SULocalizedStringFromTableInBundle(@"An error occurred while running the updater. Please try again later.", SPARKLE_TABLE, SUSparkleBundle(), nil),
NSLocalizedFailureReasonErrorKey:[NSString stringWithFormat:@"The remote port connection was invalidated from the updater. If your application is sandboxed, please ensure Installer Connection & Status entitlements are correctly set up: https://sparkle-project.org/documentation/sandboxing/ . Otherwise if %@ %@ not adhoc signed, your app must be signed with a matching team ID. For additional details, check Console logs for %@", impactedTools, (usingInstallerService ? @"are" : @"is"), impactedTools]
NSLocalizedFailureReasonErrorKey:@"The remote port connection was invalidated from the updater. For additional details, please check Console logs for "@SPARKLE_RELAUNCH_TOOL_NAME". If your application is sandboxed, please also ensure Installer Connection & Status entitlements are correctly set up: https://sparkle-project.org/documentation/sandboxing/"
};
[strongSelf _reportInstallerError:strongSelf->_installerError genericErrorCode:SUInstallationError genericUserInfo:genericUserInfo];
@@ -230,8 +225,10 @@
{
NSString *pathToRelaunch = _applicationBundle.bundlePath;
#if SPARKLE_BUILD_DMG_SUPPORT || SPARKLE_BUILD_LEGACY_SUUPDATER
id<SPUUpdaterDelegate> updaterDelegate = _updaterDelegate;
id updater = _updater;
#endif
#if SPARKLE_BUILD_LEGACY_SUUPDATER
// Give the delegate one more chance for determining the path to relaunch via a private API used by SUUpdater
@@ -244,9 +241,11 @@
#endif
NSString *decryptionPassword = nil;
#if SPARKLE_BUILD_DMG_SUPPORT
if (updater != nil && [updaterDelegate respondsToSelector:@selector(decryptionPasswordForUpdater:)]) {
decryptionPassword = [updaterDelegate decryptionPasswordForUpdater:updater];
}
#endif
id<SPUInstallerDriverDelegate> delegate = _delegate;
@@ -413,8 +412,7 @@
if (!retrievedLaunchStatus) {
#pragma clang diagnostic pop
NSError *error =
[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedStringFromTableInBundle(@"An error occurred while connecting to the installer. Please try again later.", SPARKLE_TABLE, SUSparkleBundle(), nil),
NSLocalizedFailureReasonErrorKey: [NSString stringWithFormat:@"If your app is not sandboxed, please remove or disable %@ in your app's Info.plist. Otherwise please check Console logs for "@INSTALLER_LAUNCHER_NAME" and "@SPARKLE_RELAUNCH_TOOL_NAME" processes if there are additional details.", SUEnableInstallerLauncherServiceKey]}];
[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:SULocalizedStringFromTableInBundle(@"An error occurred while connecting to the installer. Please try again later.", SPARKLE_TABLE, SUSparkleBundle(), nil) }];
completionHandler(error);
@@ -447,10 +445,26 @@
NSString *installationType = _updateItem.installationType;
assert(installationType != nil);
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:[NSBundle mainBundle]];
// We use SUHost.name property, so an application
// The installer launcher could be in a XPC service, so we don't want to do localization in there
// Make sure the authorization prompt reflects whether or not the updater is updating itself, or
// if the updater is updating another application. We use SUHost.name property, so an application
// or Sparkle helper application can override its name with SUBundleName key
SUHost *mainBundleHost = [[SUHost alloc] initWithBundle:[NSBundle mainBundle]];
NSString *mainBundleName = mainBundleHost.name;
NSString *hostName = _host.name;
// Changing this authorization prompt is a little complicated because the
// Auth database retains and caches the right we use, and there isn't a good way
// of updating the prompt. See code in SUInstallerLauncher.m
// For this reason, we don't provide localized strings for this prompt yet
// (and I believe, the authorization framework has a different way of specifying localizations..)
NSString *authorizationPrompt;
if ([mainBundleName isEqualToString:hostName]) {
authorizationPrompt = [NSString stringWithFormat:@"%1$@ wants permission to update.", hostName];
} else {
authorizationPrompt = [NSString stringWithFormat:@"%1$@ wants permission to update %2$@.", mainBundleName, hostName];
}
NSString *mainBundleIdentifier;
{
@@ -458,7 +472,7 @@
mainBundleIdentifier = (bundleIdentifier == nil) ? mainBundleName : bundleIdentifier;
}
[installerLauncher launchInstallerWithHostBundlePath:hostBundlePath updaterIdentifier:mainBundleIdentifier mainBundleName:mainBundleName installationType:installationType allowingDriverInteraction:driverAllowsInteraction completion:^(SUInstallerLauncherStatus result, BOOL systemDomain) {
[installerLauncher launchInstallerWithHostBundlePath:hostBundlePath updaterIdentifier:mainBundleIdentifier authorizationPrompt:authorizationPrompt installationType:installationType allowingDriverInteraction:driverAllowsInteraction completion:^(SUInstallerLauncherStatus result, BOOL systemDomain) {
dispatch_async(dispatch_get_main_queue(), ^{
#if INSTALLER_LAUNCHER_XPC_SERVICE_EMBEDDED
retrievedLaunchStatus = YES;
+2 -14
View File
@@ -586,21 +586,9 @@ static const NSTimeInterval SUScheduledUpdateIdleEventLeewayInterval = DEBUG ? 3
NSBundle *sparkleBundle = SUSparkleBundle();
#endif
// Ideally we should use -[NSAlert alertWithError:] however
// unfortunately Sparkle may return error messages with descriptions that contain
// recovery suggestions. So we will check if an explicit recovery suggestion exists,
// and set the mesage and informative text appropriately.
// In the future we should audit potential error messages and make them consistent.
NSAlert *alert = [[NSAlert alloc] init];
NSString *recoverySuggestion = [error localizedRecoverySuggestion];
if (recoverySuggestion != nil) {
alert.messageText = error.localizedDescription;
alert.informativeText = recoverySuggestion;
} else {
alert.messageText = SULocalizedStringFromTableInBundle(@"Update Error!", SPARKLE_TABLE, sparkleBundle, nil);
alert.informativeText = error.localizedDescription;
}
alert.messageText = SULocalizedStringFromTableInBundle(@"Update Error!", SPARKLE_TABLE, sparkleBundle, nil);
alert.informativeText = [NSString stringWithFormat:@"%@", [error localizedDescription]];
[alert addButtonWithTitle:SULocalizedStringFromTableInBundle(@"Cancel Update", SPARKLE_TABLE, sparkleBundle, nil)];
[self showAlert:alert secondaryAction:nil];
+2 -9
View File
@@ -342,18 +342,11 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
if (!hasAnyPublicKey) {
if ((feedURL != nil && !servingOverHttps) || ![SUCodeSigningVerifier bundleAtURLIsCodeSigned:[[self hostBundle] bundleURL]]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"For security reasons, updates need to be signed with an EdDSA key for %@. Visit Sparkle's documentation for more information.", hostName] }];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"For security reasons, updates need to be signed with an EdDSA key for %@. See Sparkle's documentation for more information.", hostName] }];
}
return NO;
} else {
BOOL verifyBeforeExtraction = [_host boolForInfoDictionaryKey:SUVerifyUpdateBeforeExtractionKey];
if (verifyBeforeExtraction) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"For security reasons, updates need to be signed with an EdDSA key because %@ is specified for %@. Visit Sparkle's documentation for more information.", SUVerifyUpdateBeforeExtractionKey, hostName] }];
}
return NO;
} else if (_updatingMainBundle && !_loggedNoSecureKeyWarning) {
if (_updatingMainBundle && !_loggedNoSecureKeyWarning) {
SULog(SULogLevelError, @"Error: Serving updates without an EdDSA key and only using Apple Code Signing is deprecated and may be unsupported in a future release. Visit Sparkle's documentation for more information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns");
_loggedNoSecureKeyWarning = YES;
+1 -1
View File
@@ -108,7 +108,7 @@ SU_EXPORT extern NSString *const SUSystemProfilerPreferredLanguageKey;
This feature was added in Sparkle 2.
@return The set of channel names the updater is allowed to find new updates in. An empty set is the default behavior,
which means the updater will only look for updates in the default channel. The default channel is always included in the allowed set.
which means the updater will only look for updates in the default channel.
*/
- (NSSet<NSString *> *)allowedChannelsForUpdater:(SPUUpdater *)updater;
+1 -1
View File
@@ -163,7 +163,7 @@
if (fileSize != nil && ![deltaItem.deltaFromSparkleExecutableSize isEqualToNumber:fileSize]) {
sparkleExecutableIsOK = NO;
SULog(SULogLevelDefault, @"Expected file size (%llu) of Sparkle's executable does not match actual file size (%llu). Skipping delta update.", deltaItem.deltaFromSparkleExecutableSize.unsignedLongLongValue, fileSize.unsignedLongLongValue);
SULog(SULogLevelDefault, @"Expected file size (%lld) of Sparkle's executable does not match actual file size (%lld). Skipping delta update.", deltaItem.deltaFromSparkleExecutableSize.unsignedLongLongValue, fileSize.unsignedLongLongValue);
} else {
sparkleExecutableIsOK = YES;
}
-1
View File
@@ -48,7 +48,6 @@ extern NSString *const SULastCheckTimeKey;
extern NSString *const SUPublicDSAKeyKey;
extern NSString *const SUPublicDSAKeyFileKey;
extern NSString *const SUPublicEDKeyKey;
extern NSString *const SUVerifyUpdateBeforeExtractionKey;
extern NSString *const SUAutomaticallyUpdateKey;
extern NSString *const SUAllowsAutomaticUpdatesKey;
extern NSString *const SUEnableAutomaticChecksKey;
-1
View File
@@ -44,7 +44,6 @@ NSString *const SULastCheckTimeKey = @"SULastCheckTime";
NSString *const SUPublicDSAKeyKey = @"SUPublicDSAKey";
NSString *const SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
NSString *const SUPublicEDKeyKey = @"SUPublicEDKey";
NSString *const SUVerifyUpdateBeforeExtractionKey = @"SUVerifyUpdateBeforeExtraction";
NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
NSString *const SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
NSString *const SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
+6 -31
View File
@@ -11,37 +11,12 @@
#include "AppKitPrevention.h"
static void SULogErrors(NSArray<NSError *> *errors, int recursionLimit)
{
if (recursionLimit == 0) {
return;
}
for (NSError *error in errors) {
SULog(SULogLevelError, @"Error: %@ %@ (URL %@)", error.localizedDescription, error.localizedFailureReason, error.userInfo[NSURLErrorFailingURLErrorKey]);
NSDictionary<NSErrorUserInfoKey, id> *userInfo = error.userInfo;
if (@available(macOS 11.3, *)) {
NSArray<NSError *> *underlyingErrors = userInfo[NSMultipleUnderlyingErrorsKey];
if (underlyingErrors != nil) {
SULogErrors(underlyingErrors, recursionLimit - 1);
continue;
}
}
NSError *underlyingError = userInfo[NSUnderlyingErrorKey];
if (underlyingError != nil) {
SULogErrors(@[underlyingError], recursionLimit - 1);
}
}
}
void SULogError(NSError *error)
{
if (error == nil) {
return;
}
SULogErrors(@[error], 7);
NSError *errorToDisplay = error;
int finiteRecursion = 5;
do {
SULog(SULogLevelError, @"Error: %@ %@ (URL %@)", errorToDisplay.localizedDescription, errorToDisplay.localizedFailureReason, errorToDisplay.userInfo[NSURLErrorFailingURLErrorKey]);
errorToDisplay = errorToDisplay.userInfo[NSUnderlyingErrorKey];
} while(--finiteRecursion && errorToDisplay);
}
-5
View File
@@ -32,10 +32,6 @@ void SULog(SULogLevel level, NSString *format, ...)
// Note we don't take advantage of info like the source line number because we wrap this macro inside our own function
// And we don't really leverage of os_log's deferred formatting processing because we format the string before passing it in
switch (level) {
#pragma clang diagnostic push
#if __has_warning("-Wpre-c11-compat")
#pragma clang diagnostic ignored "-Wpre-c11-compat"
#endif
case SULogLevelDefault:
// See docs for OS_LOG_TYPE_DEFAULT
// By default, OS_LOG_TYPE_DEFAULT seems to be more noticeable than OS_LOG_TYPE_INFO
@@ -45,6 +41,5 @@ void SULog(SULogLevel level, NSString *format, ...)
// See docs for OS_LOG_TYPE_ERROR
os_log_error(logger, "%{public}@", logMessage);
break;
#pragma clang diagnostic pop
}
}
+1 -3
View File
@@ -23,10 +23,8 @@ SPU_OBJC_DIRECT_MEMBERS
- (instancetype)initWithDownloadPath:(NSString *)downloadPath signatures:(SUSignatures *)signatures host:(SUHost *)host verifierInformation:(SPUVerifierInformation * _Nullable)verifierInformation;
- (BOOL)validateHostHasPublicKeys:(NSError **)error;
// This is "pre" validation, before the archive has been extracted
- (BOOL)validateDownloadPathWithFallbackOnCodeSigning:(BOOL)fallbackOnCodeSigning error:(NSError **)error;
- (BOOL)validateDownloadPathWithError:(NSError **)error;
// This is "post" validation, after an archive has been extracted
- (BOOL)validateWithUpdateDirectory:(NSString *)updateDirectory error:(NSError **)error;
+19 -104
View File
@@ -27,7 +27,6 @@
SPUVerifierInformation *_verifierInformation;
BOOL _prevalidatedSignature;
BOOL _validatedDownloadUsingCodeSigning;
}
- (instancetype)initWithDownloadPath:(NSString *)downloadPath signatures:(SUSignatures *)signatures host:(SUHost *)host verifierInformation:(SPUVerifierInformation * _Nullable)verifierInformation
@@ -42,76 +41,25 @@
return self;
}
- (BOOL)validateHostHasPublicKeys:(NSError * __autoreleasing *)error
{
SUPublicKeys *publicKeys = _host.publicKeys;
if (!publicKeys.hasAnyKeys) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInsufficientSigningError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to validate update before unarchiving because no (Ed)DSA public key was found in the old app" }];
}
return NO;
}
return YES;
}
- (BOOL)validateDownloadPathWithFallbackOnCodeSigning:(BOOL)fallbackOnCodeSigning error:(NSError * __autoreleasing *)error
- (BOOL)validateDownloadPathWithError:(NSError * __autoreleasing *)error
{
SUPublicKeys *publicKeys = _host.publicKeys;
SUSignatures *signatures = _signatures;
NSError *dsaVerificationError = nil;
if ([SUSignatureVerifier validatePath:_downloadPath withSignatures:signatures withPublicKeys:publicKeys verifierInformation:_verifierInformation error:&dsaVerificationError]) {
_prevalidatedSignature = YES;
return YES;
}
NSMutableArray<NSError *> *underlyingErrors = [[NSMutableArray alloc] init];
if (dsaVerificationError != nil) {
[underlyingErrors addObject:dsaVerificationError];
}
if (fallbackOnCodeSigning) {
SULog(SULogLevelError, @"Failed to validate update archive with (Ed)DSA signing. Trying fallback with Apple Developer ID code signing verification: %@", dsaVerificationError);
// (Ed)DSA validation failed + signed archives are required + regular app update
// As fallback for key rotation, check if the archive is Developer ID signed with a team ID that matches the host
NSError *codeSignError = nil;
NSURL *downloadURL = [NSURL fileURLWithPath:_downloadPath isDirectory:NO];
if (![SUCodeSigningVerifier codeSignatureIsValidAtDownloadURL:downloadURL andMatchesDeveloperIDTeamFromOldBundleURL:_host.bundle.bundleURL error:&codeSignError]) {
SULog(SULogLevelError, @"Failed to validate update archive with Developer ID code signing fallback: %@", codeSignError);
if (codeSignError != nil) {
[underlyingErrors addObject:codeSignError];
}
} else {
if (!publicKeys.hasAnyKeys) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to validate update before unarchiving because no (Ed)DSA public key was found in the old app" }];
}
} else {
NSError *innerError = nil;
if ([SUSignatureVerifier validatePath:_downloadPath withSignatures:signatures withPublicKeys:publicKeys verifierInformation:_verifierInformation error:&innerError]) {
_prevalidatedSignature = YES;
_validatedDownloadUsingCodeSigning = YES;
return YES;
}
}
if (error != NULL) {
NSMutableDictionary<NSString *, id> *userInfo = [[NSMutableDictionary alloc] init];
userInfo[NSLocalizedDescriptionKey] = [NSString stringWithFormat:@"(Ed)DSA signature validation before unarchiving failed for update %@", _downloadPath];
if (dsaVerificationError != nil) {
// This is the primary error
userInfo[NSUnderlyingErrorKey] = dsaVerificationError;
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"(Ed)DSA signature validation before unarchiving failed for update %@", _downloadPath], NSUnderlyingErrorKey: innerError }];
}
if (underlyingErrors.count > 1) {
if (@available(macOS 11.3, *)) {
userInfo[NSMultipleUnderlyingErrorsKey] = [underlyingErrors copy];
}
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:[userInfo copy]];
}
return NO;
}
@@ -171,9 +119,9 @@
#endif
else
{
// We already validated the download archive
// We already validated the EdDSA signature
// Let's check if the update passes Sparkle's basic update policy and that the update is properly signed
// Currently, this case gets hit for binary delta updates and updates requiring SUVerifyUpdateBeforeExtraction
// Currently, this case gets hit only for binary delta updates and .aar/.yaa archives
NSBundle *newBundle = [NSBundle bundleWithURL:installSourceURL];
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
@@ -192,47 +140,15 @@
return NO;
}
NSError *codeSigningInnerError = nil;
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:installSourceURL error:&codeSigningInnerError]) {
NSError *innerError = nil;
if (updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:installSourceURL error:&innerError]) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[NSLocalizedDescriptionKey] = @"The update archive is validly signed, but the app's Apple code signing signature is corrupted. The update will be rejected.";
if (codeSigningInnerError != nil) {
userInfo[NSUnderlyingErrorKey] = codeSigningInnerError;
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:userInfo];
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"Failed to validate apple code sign signature on bundle after archive validation", NSUnderlyingErrorKey: innerError }];
}
return NO;
}
if (_validatedDownloadUsingCodeSigning) {
// Old EdDSA key failed on download archive, and Apple Code signing validation was used as a fallback (with SUVerifyUpdateBeforeExtraction set to YES),
// which means the developer may be rotating keys.
// So we must validate new EdDSA key with the new download.
// This is a policy to ensure the next update can be updatable with the new EdDSA key (not a security measure).
NSError *validateInnerError = nil;
BOOL validationCheckSuccess = [SUSignatureVerifier validatePath:downloadPath withSignatures:signatures withPublicKeys:newPublicKeys verifierInformation:_verifierInformation error:&validateInnerError];
if (!validationCheckSuccess) {
if (error != NULL) {
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
userInfo[NSLocalizedDescriptionKey] = @"(Ed)DSA signature validation failed after using Apple code signing to validate the update archive. The update has a public (Ed)DSA key, but the public key shipped with the update doesn't match the signature. To prevent future problems, the update will be rejected.";
if (validateInnerError != nil) {
userInfo[NSUnderlyingErrorKey] = validateInnerError;
}
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:userInfo];
}
return NO;
}
}
return YES;
}
}
@@ -346,10 +262,10 @@
if (hostIsCodeSigned) {
passedCodeSigning = [SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL andMatchesSignatureAtBundleURL:host.bundle.bundleURL error:&codeSignedError];
}
// If code signing passes, and the new DSA key differs from the old, the check ensures that the app author has correctly used DSA keys for the new update, so the app will be updateable in the next version.
// Code signing passing ensures the new DSA key can also be trusted for validating the archive.
// If code signing doesn't pass, DSA validation failing will be an error either way.
// End of security-critical part
// If the new DSA key differs from the old, then this check is not a security measure, because the new key is not trusted.
// In that case, the check ensures that the app author has correctly used DSA keys, so that the app will be updateable in the next version.
if (!passedDSACheck && newHasAnyDSAKey) {
NSError *innerError = nil;
if (![SUSignatureVerifier validatePath:downloadedPath withSignatures:signatures withPublicKeys:newPublicKeys verifierInformation:_verifierInformation error:&innerError]) {
@@ -359,7 +275,6 @@
return NO;
}
}
// End of security-critical part
// If the new update is code signed but it's not validly code signed, we reject it
NSError *innerError = nil;
+4 -4
View File
@@ -35,7 +35,7 @@
BOOL _drawsWebViewBackground;
}
static WKUserScript *makeUserScriptWithInjectedStyleSource(NSString *styleSource)
static WKUserScript *_userScriptWithInjectedStyleSource(NSString *styleSource)
{
// We must remove newlines when inserting the style source in this interpolated string below
NSString *strippedStyleSource = [styleSource stringByReplacingOccurrencesOfString:@"\n" withString:@""];
@@ -53,7 +53,7 @@ static WKUserScript *makeUserScriptWithInjectedStyleSource(NSString *styleSource
return [[WKUserScript alloc] initWithSource:scriptSource injectionTime:WKUserScriptInjectionTimeAtDocumentEnd forMainFrameOnly:YES];
}
static WKUserScript *makeUserScriptForExposingCurrentRelease(NSString *releaseString)
static WKUserScript *_userScriptForExposingCurrentRelease(NSString *releaseString)
{
// Check that release string can be safely injected
NSMutableCharacterSet *allowedCharacterSet = [NSMutableCharacterSet alphanumericCharacterSet];
@@ -112,14 +112,14 @@ static WKUserScript *makeUserScriptForExposingCurrentRelease(NSString *releaseSt
// In fact, we must execute javascript to properly inject our default CSS style into the DOM
// Legacy WebView has exposed methods for custom stylesheets and default fonts,
// but WKWebView seems to forgo that type of API surface in favor of user scripts like this
WKUserScript *userScriptWithInjectedStyleSource = makeUserScriptWithInjectedStyleSource(finalStyleContents);
WKUserScript *userScriptWithInjectedStyleSource = _userScriptWithInjectedStyleSource(finalStyleContents);
if (userScriptWithInjectedStyleSource == nil) {
SULog(SULogLevelError, @"Failed to create script for injecting style");
} else {
[userContentController addUserScript:userScriptWithInjectedStyleSource];
}
WKUserScript *userScriptForExposingCurrentRelease = makeUserScriptForExposingCurrentRelease(installedVersion);
WKUserScript *userScriptForExposingCurrentRelease = _userScriptForExposingCurrentRelease(installedVersion);
if (userScriptForExposingCurrentRelease == nil) {
SULog(SULogLevelDefault, @"warning: Failed to create script for injecting version %@", installedVersion);
} else {
+1 -1
View File
@@ -11,7 +11,7 @@
"%@ of %@" = "%1$@ de %2$@";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ no es pot actualitzar quan funciona des d'un disc d'imatge.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ no es pot actualitzar quan funciona des d'un disc d'imatge.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Hi ha una nova versió de %@ disponible!";
+1 -1
View File
@@ -41,7 +41,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "Aplikace %1$@ nemůže být aktualizována pokud je spuštěna z umístění, ve kterém je stažena.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "Aplikace %1$@ nemůže být aktualizována, protože je spuštěna z dočasného umístění nebo z umístění, na které nelze zapisovat.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "Aplikace %1$@ nemůže být aktualizována, protože je spuštěna z dočasného umístění nebo z umístění, na které nelze zapisovat.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Je dostupná nová verze aplikace %@!";
+1 -1
View File
@@ -20,7 +20,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ er hentet og klar til brug! Vil du installere og genstarte %1$@ nu?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ kan ikke opdateres når det køres fra en kun læsbar enhed.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ kan ikke opdateres når det køres fra en kun læsbar enhed.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "En ny version af %@ er tilgængelig!";
+1 -1
View File
@@ -41,7 +41,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "„%1$@“ kann nicht aktualisiert werden, wenn das Programm von dem Ort ausgeführt wird, an den es heruntergeladen wurde.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG-Datei oder einem Laufwerk ohne Schreibzugriff gestartet wurde.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ kann nicht aktualisiert werden, da es aus dem Downloads-Order, oder von einer DMG-Datei oder einem Laufwerk ohne Schreibzugriff gestartet wurde.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Eine neue Version von %@ ist verfügbar!";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "Το %1$@ %2$@ κατέβηκε. Είναι έτοιμο προς εγκατάσταση! Θέλετε να εγκαταστήσετε και να επανεκκινήσετε το %1$@ τώρα;";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "Το %1$@ δεν μπορεί να ενημερωθεί όσο τρέχει από έναν δίσκο ανάγνωσης-μόνο ή έναν οπτικό δίσκο.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "Το %1$@ δεν μπορεί να ενημερωθεί όσο τρέχει από έναν δίσκο ανάγνωσης-μόνο ή έναν οπτικό δίσκο.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Μία νέα έκδοση του %@ είναι διαθέσιμη!";
+1 -1
View File
@@ -23,7 +23,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "¡%1$@ %2$@ se ha descargado y está lista para usarse! ¿Te gustaría instalarla y volver a abrir %1$@ ahora?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ no se puede actualizar porque fue abierta desde una ubicación temporal o de solo lectura.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ no se puede actualizar porque fue abierta desde una ubicación temporal o de solo lectura.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "¡Una nueva versión de %@ está disponible!";
+1 -1
View File
@@ -26,7 +26,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ نمی‌تواند به‌روزرسانی شود، اگر از محلی که در آن بارگیری شده باز شود";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ نمی‌تواند به‌روزرسانی شود، زیرا از محلی با سطح دسترسی فقط-خواندن یا موقت باز شده است";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ نمی‌تواند به‌روزرسانی شود، زیرا از محلی با سطح دسترسی فقط-خواندن یا موقت باز شده است";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "نسخه‌ای جدید از %@ در دسترس است";
+1 -1
View File
@@ -26,7 +26,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ ne peut pas être mis à jour s’il est exécuté depuis le dossier dans lequel il a été téléchargé.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ ne peut pas être mis à jour quand il fonctionne à partir d’un volume en lecture seule, comme une image disque ou un lecteur optique.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ ne peut pas être mis à jour quand il fonctionne à partir d’un volume en lecture seule, comme une image disque ou un lecteur optique.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Une nouvelle version de %@ est disponible !";
+1 -1
View File
@@ -14,7 +14,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "לא ניתן לעדכן את %1$@ כשהוא פועל מהמיקום אליו הוא הורד.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "לא ניתן לעדכן את %1$@ מכיוון שהוא נפתח ממיקום זמני או לקריאה בלבד.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "לא ניתן לעדכן את %1$@ מכיוון שהוא נפתח ממיקום זמני או לקריאה בלבד.";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%@ %@ היא הגרסה החדשה ביותר שזמינה כרגע.";
+1 -1
View File
@@ -23,7 +23,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ je preuzeta i spremna za upotrebu! Želiš li je sada instalirati, te ponovo pokrenuti %1$@?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ nije moguće aktualizirati, jer je pokrenuta s lokacije bez korisničkih prava pisanja, npr. dmg.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ nije moguće aktualizirati, jer je pokrenuta s lokacije bez korisničkih prava pisanja, npr. dmg.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Dostupna je nova verzija za %@!";
+1 -1
View File
@@ -14,7 +14,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ non può essere aggiornata se è in esecuzione dalla posizione in cui è stato scaricata.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ non può essere aggiornata perché è stata aperta da una posizione di sola lettura o temporanea.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ non può essere aggiornata perché è stata aperta da una posizione di sola lettura o temporanea.";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ è la versione più recente attualmente disponibile.";
+1 -1
View File
@@ -41,7 +41,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "この場所ではダウンロードされたアップデートを%1$@に適用できません。";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@は読み出し専用または一時的な場所で開かれているためアップデートできません。";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@は読み出し専用または一時的な場所で開かれているためアップデートできません。";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "新しいバージョンの%@が入手できます!";
+1 -1
View File
@@ -14,7 +14,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ 이(가) 다운로드된 위치에서 실행 중인 경우에는 업데이트할 수 없습니다.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ 이(가) 디스크 이미지나 CD 드라이브 같은 읽기 전용 볼륨에서 실행되고 있으므로 업데이트할 수 없습니다.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ 이(가) 디스크 이미지나 CD 드라이브 같은 읽기 전용 볼륨에서 실행되고 있으므로 업데이트할 수 없습니다.";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ 이(가) 현재 최신 버전입니다.";
+1 -1
View File
@@ -20,7 +20,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ er lastet ned og er klar til bruk! Ønsker du å installere og restarte %1$@ nå?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ kan ikke oppdateres fra en 'bare lesbar' enhet som f.eks. en cd";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ kan ikke oppdateres fra en 'bare lesbar' enhet som f.eks. en cd";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "En ny versjon av %@ er tilgjengelig!";
+1 -1
View File
@@ -41,7 +41,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "%1$@ kan niet worden bijgewerkt als het is geopend vanuit de downloadlocatie.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ kan niet worden bijgewerkt, omdat het vanuit een alleen-lezen- of tijdelijke locatie is geopend.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ kan niet worden bijgewerkt, omdat het vanuit een alleen-lezen- of tijdelijke locatie is geopend.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Een nieuwe versie van %@ is beschikbaar!";
+1 -1
View File
@@ -2,7 +2,7 @@
"5.title" = "Programoppdatering";
/* Class = "NSTextFieldCell"; title = "Release Notes:"; ObjectID = "170"; */
"170.title" = "Om oppdateringa:";
"170.title" = "Om oppdateringen:";
/* Class = "NSButtonCell"; title = "Remind Me Later"; ObjectID = "171"; */
"171.title" = "Utsett";
+1 -1
View File
@@ -20,7 +20,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ er lasta ned og er klar til bruk! Ynskjer du å installera og starta om att %1$@ no?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ kan ikkje oppdaterast frå ei eining som berre kan lesast, t.d. frå ein cd";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ kan ikkje oppdaterast frå ei eining som berre kan lesast, t.d. frå ein cd";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Ein ny versjon av %@ er tilgjengeleg!";
+1 -1
View File
@@ -20,7 +20,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ został pobrany i jest gotowy do użycia! Czy chcesz teraz zainstalować i ponownie uruchomić %1$@?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ nie może zostać uaktualniony, ponieważ został uruchomiony z folderu tymczasowego lub tylko do odczytu.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ nie może zostać uaktualniony, ponieważ został uruchomiony z folderu tymczasowego lub tylko do odczytu.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Dostępna jest nowa wersja %@!";
+1 -1
View File
@@ -38,7 +38,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "O app %1$@ não pode ser atualizado se ele estiver aberto do local onde foi baixado.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "O app %1$@ não pode ser atualizado porque foi aberto de um volume somente leitura ou local temporário.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "O app %1$@ não pode ser atualizado porque foi aberto de um volume somente leitura ou local temporário.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Uma nova versão do app %@ está disponível!";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "O %1$@ %2$@ foi transferido e está pronto a instalar! Gostaria de o fazer agora e reiniciar o %1$@ posteriormente?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "O %1$@ não pode ser actualizado quando estiver a ser executado a partir de um volume apenas de leitura como uma imagem de disco ou disco óptico.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "O %1$@ não pode ser actualizado quando estiver a ser executado a partir de um volume apenas de leitura como uma imagem de disco ou disco óptico.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Uma nova versão do %@ está dísponível!";
+1 -1
View File
@@ -20,7 +20,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ a fost descărcată și este gata de utilizare! Dorești să o instalezi și să relansați %1$@ acum?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ nu poate fi actualizată atunci când a fost pornită de pe un volum read-only ca o imagine disc sau o unitate optică.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ nu poate fi actualizată atunci când a fost pornită de pe un volum read-only ca o imagine disc sau o unitate optică.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "O nouă versiune pentru %@ este disponibilă!";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ загружен и готов к использованию! Хотите установить и перезапустить %1$@?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "Не удаётся обновить %1$@ с тома, предназначенного только для чтения.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "Не удаётся обновить %1$@ с тома, предназначенного только для чтения.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Имеется новая версия %@!";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "Aplikácia %1$@ %2$@ bola prevzatá a je pripravená na použitie! Chcete teraz nainštalovať a následne znovu spustiť %1$@?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "Aplikáciu %1$@ nemožno aktualizovať, ak je spustená zo zväzku s právami len na čítanie (napríklad z obrazu disku alebo optického disku).";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "Aplikáciu %1$@ nemožno aktualizovať, ak je spustená zo zväzku s právami len na čítanie (napríklad z obrazu disku alebo optického disku).";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Je dostupná nová verzia aplikácie %@!";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ je bil uspešno prenešen s spleta in je pripravljen na namestitev. Ga želite namestiti in ponovno zagnati takoj?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "Programa %1$@ ni mogoče posodobiti, ker ga poganjate iz lokacije, kamor pisanje ni dovoljeno (pogosto je to slika diska dmg ali optična enota).";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "Programa %1$@ ni mogoče posodobiti, ker ga poganjate iz lokacije, kamor pisanje ni dovoljeno (pogosto je to slika diska dmg ali optična enota).";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Na voljo je nova verzija programa %@.";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ ได้ถูกดาวน์โหลดและพร้อมใช้งานแล้ว คุณต้องการติดตั้งและเริ่ม %1$@ ใหม่เดี๋ยวนี้หรือไม่";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ ไม่สามารถรับการอัพเดทได้เมื่อถูกเรียกจากดิสก์แบบอ่านอย่างเดียวหรือซีดีรอม ย้าย";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ ไม่สามารถรับการอัพเดทได้เมื่อถูกเรียกจากดิสก์แบบอ่านอย่างเดียวหรือซีดีรอม ย้าย";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "%@ มีเวอร์ชั่นใหม่!";
+1 -1
View File
@@ -20,7 +20,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ indirildi ve kullanıma hazır! Şimdi yüklemek ister misiniz? Uygulama yeniden başlatılacaktır.";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "%1$@ uygulaması geçici veya salt okunur bir konumdan açıldığı için güncellenemiyor.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "%1$@ uygulaması geçici veya salt okunur bir konumdan açıldığı için güncellenemiyor.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "%@ uygulaması için yeni bir sürüm kullanılabilir!";
+1 -1
View File
@@ -17,7 +17,7 @@
"%1$@ %2$@ has been downloaded and is ready to use! Would you like to install it and relaunch %1$@ now?" = "%1$@ %2$@ завантажений і готовий до використання! Бажаєте встановити і перезавантажити %1$@?";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "Під час роботи з %1$@ з тому, що призначений лише для читання, наприклад, образу диска чи оптичного диску, його неможливо оновити.";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "Під час роботи з %1$@ з тому, що призначений лише для читання, наприклад, образу диска чи оптичного диску, його неможливо оновити.";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "Доступна нова версія %@!";
+1 -1
View File
@@ -23,7 +23,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "如果在下载位置运行此程序,则无法对 %1$@ 进行更新。";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "无法更新 %1$@,因为它运行于一个只读或临时位置。";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "无法更新 %1$@,因为它运行于一个只读或临时位置。";
/* No comment provided by engineer. */
"A new version of %@ is available!" = "新版本的 %@ 已经发布";
+1 -1
View File
@@ -14,7 +14,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "如果從下載位置運行 %1$@,則無法進行更新。";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "無法更新 %1$@,因爲佢運行於一個只讀或臨時位置。";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "無法更新 %1$@,因爲佢運行於一個只讀或臨時位置。";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ 已係目前最新版本。";
+1 -1
View File
@@ -14,7 +14,7 @@
"%1$@ can’t be updated if it’s running from the location it was downloaded to." = "當從下載位置執行 %1$@ 時,無法進行更新。";
/* No comment provided by engineer. */
"%1$@ can’t be updated because it was opened from a read-only or a temporary location." = "當 %1$@ 正從唯讀卷宗(如磁碟映像檔或光碟機)執行時,無法進行更新。";
"%1$@ can’t be updated, because it was opened from a read-only or a temporary location." = "當 %1$@ 正從唯讀卷宗(如磁碟映像檔或光碟機)執行時,無法進行更新。";
/* No comment provided by engineer. */
"%@ %@ is currently the newest version available." = "%1$@ %2$@ 已是目前最新的版本。";
Binary file not shown.
-43
View File
@@ -23,9 +23,6 @@
NSURL *_devSignedAppURL;
NSURL *_devSignedVersion2AppURL;
NSURL *_devInvalidSignedAppURL;
NSURL *_devSignedDiskImageURL;
NSURL *_unsignedDiskImageURL;
NSURL *_adhocSignedDiskImageURL;
}
- (void)setUp
@@ -33,11 +30,6 @@
[super setUp];
NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];
_devSignedDiskImageURL = [unitTestBundle URLForResource:@"DevSignedAppVersion2" withExtension:@"dmg"];
_unsignedDiskImageURL = [unitTestBundle URLForResource:@"SparkleTestCodeSign_apfs" withExtension:@"dmg"];
_adhocSignedDiskImageURL = [unitTestBundle URLForResource:@"SparkleTestCodeSign_apfs_lzma_aux_files_adhoc" withExtension:@"dmg"];
NSString *zippedAppURL = [unitTestBundle pathForResource:@"SparkleTestCodeSignApp" ofType:@"zip"];
SUFileManager *fileManager = [[SUFileManager alloc] init];
@@ -256,41 +248,6 @@
}
}
- (void)testValidMatchingDevIdDiskImage
{
NSError *error = nil;
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtDownloadURL:_devSignedDiskImageURL andMatchesDeveloperIDTeamFromOldBundleURL:_devSignedAppURL error:&error]);
XCTAssertNil(error);
}
- (void)testInvalidMatchingDevIdDiskImageWithAppNoSigning
{
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtDownloadURL:_devSignedDiskImageURL andMatchesDeveloperIDTeamFromOldBundleURL:_notSignedAppURL error:&error]);
XCTAssertNotNil(error);
}
- (void)testInvalidMatchingDevIdDiskImageWithAppAdhocSigning
{
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtDownloadURL:_devSignedDiskImageURL andMatchesDeveloperIDTeamFromOldBundleURL:_validSignedAppURL error:&error]);
XCTAssertNotNil(error);
}
- (void)testInvalidMatchWithNoDiskImageSigning
{
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtDownloadURL:_unsignedDiskImageURL andMatchesDeveloperIDTeamFromOldBundleURL:_validSignedAppURL error:&error]);
XCTAssertNotNil(error);
}
- (void)testInvalidMatchWithAdhocSignedDiskImage
{
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtDownloadURL:_adhocSignedDiskImageURL andMatchesDeveloperIDTeamFromOldBundleURL:_devSignedAppURL error:&error]);
XCTAssertNotNil(error);
}
- (void)testInvalidMatchingWithBrokenBundle
{
// We can't test our own app because matching with ad-hoc signed apps understandably does not succeed
+1 -1
View File
@@ -56,7 +56,7 @@
NSError *installerError = nil;
// Note: we may not be using the "correct" home directory or user name (they will be root) but our test pkg does not have
// pre/post install scripts so it doesn't matter
id<SUInstallerProtocol> installer = [SUInstaller installerForHost:host expectedInstallationType:SPUInstallationTypeGuidedPackage updateDirectory:[path stringByDeletingLastPathComponent] connectionCodeSigningValidationSkipped:NO homeDirectory:NSHomeDirectory() userName:NSUserName() error:&installerError];
id<SUInstallerProtocol> installer = [SUInstaller installerForHost:host expectedInstallationType:SPUInstallationTypeGuidedPackage updateDirectory:[path stringByDeletingLastPathComponent] homeDirectory:NSHomeDirectory() userName:NSUserName() error:&installerError];
if (installer == nil) {
XCTFail(@"Installer is nil with error: %@", installerError);
+3 -1
View File
@@ -117,6 +117,7 @@ class SUUnarchiverTest: XCTestCase
self.unarchiveTestAppWithExtension("tar.xz")
}
#if SPARKLE_BUILD_DMG_SUPPORT
func testUnarchivingHFSDmgWithLicenseAgreement()
{
self.unarchiveTestAppWithExtension("dmg")
@@ -164,13 +165,14 @@ class SUUnarchiverTest: XCTestCase
func testUnarchivingAPFSAdhocSignedDMGWithAuxFiles()
{
self.unarchiveTestAppWithExtension("dmg", resourceName: "SparkleTestCodeSign_apfs_lzma_aux_files_adhoc")
self.unarchiveTestAppWithExtension("dmg", resourceName: "SparkleTestCodeSign_apfs_lzma_aux_files")
}
func testUnarchivingAPFSDMGWithPackage()
{
self.unarchiveTestAppWithExtension("dmg", resourceName: "SparkleTestCodeSign_pkg", expectingInstallationType: SPUInstallationTypeGuidedPackage)
}
#endif
#if SPARKLE_BUILD_PACKAGE_SUPPORT
func testUnarchivingBarePackage()
+1 -1
View File
@@ -117,7 +117,7 @@ class SUUpdateValidatorTest: XCTestCase {
let signatures = self.signatures(signatureConfig)
let validator = SUUpdateValidator(downloadPath: self.signedTestFilePath, signatures: signatures, host: host, verifierInformation: nil)
let result = (try? validator.validateHostHasPublicKeys()) != nil && (try? validator.validateDownloadPathWithFallback(onCodeSigning: false)) != nil
let result = (try? validator.validateDownloadPath()) != nil
XCTAssertEqual(result, expectedResult, "bundle: \(bundleConfig), signatures: \(signatureConfig)", line: line)
}
+3 -10
View File
@@ -283,20 +283,13 @@ func makeAppcasts(archivesSourceDir: URL, outputPathURL: URL?, cacheDirectory ca
// Decide the most appropriate delta version
let deltaVersion: SUBinaryDeltaMajorVersion
if let frameworkVersion = item.frameworkVersion {
switch standardComparator.compareVersion(frameworkVersion, toVersion: "2041") {
switch standardComparator.compareVersion(frameworkVersion, toVersion: "2010") {
case .orderedSame:
fallthrough
case .orderedDescending:
deltaVersion = .version4
deltaVersion = .version3
case .orderedAscending:
switch standardComparator.compareVersion(frameworkVersion, toVersion: "2010") {
case .orderedSame:
fallthrough
case .orderedDescending:
deltaVersion = .version3
case .orderedAscending:
deltaVersion = .version2
}
deltaVersion = .version2
}
} else {
deltaVersion = SUBinaryDeltaMajorVersionDefault
+2 -2
View File
@@ -26,11 +26,11 @@ func loadPrivateKeys(_ account: String, _ privateDSAKey: SecKey?, _ privateEdStr
print("Error: specifying private key as the argument is no longer supported.")
return nil
} else {
print("Error: Private key not decoded from the argument, which has \(data.count) bytes. Please provide a valid key and confirm the contents of the key are correct.")
print("Error: Private key not found in decoded argument, which has \(data.count) bytes. Please provide a valid key.")
return nil
}
} else {
print("Error: Private key not decoded from the argument because it isn't base64 encoded. Please provide a valid key and confirm the contents of the key are correct.")
print("Error: Private key not found in the argument. Please provide a valid key.")
return nil
}
}