Compare commits

...
23 Commits
Author SHA1 Message Date
Sparkle-Bot 87e4fcbac3 Update Package management files for version 2.4.2 2023-06-18 00:17:52 +00:00
Zorg 2af0fa916c Update CHANGELOG for 2.4.2 2023-06-17 17:07:28 -07:00
Zorg 8039288f64 Harden verification of Sparkle update download (#2392) 2023-06-17 17:01:45 -07:00
Zorg 4ca2e2eb21 Fix NSKeyedUnarchiver warning for not specifying keyed NSString class (#2383) 2023-06-11 07:04:03 -07:00
Zorg f7567e5a69 Ignore release notes download when we shouldn't show release notes (#2381) 2023-05-27 09:18:17 -04:00
Sparkle-Bot 7907f058bc Update Package management files for version 2.4.1 2023-04-13 05:37:26 +00:00
Zorg 4a322e0ab4 Update CHANGELOG 2023-04-12 22:28:29 -07:00
Zorg 270582b2e7 Pass bookmark data for the downloaded update (#2359)
Also let Xcode 14.3 update the nibs.
2023-04-12 22:23:50 -07:00
Sparkle-Bot 91a2c1c100 Update Package management files for version 2.4.1-beta.1 2023-04-07 18:35:57 +00:00
Zorg 53d58921ef Update changelog for 2.4.1 2023-04-07 11:28:04 -07:00
Zorg e15324773f Remove auxiliary apps and relocate symbols in SPM package (#2356) 2023-04-07 11:23:23 -07:00
Zorg b7b858dbf3 Fix compile error when SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE=0 (#2346) 2023-03-25 21:39:55 -07:00
Kent Sutherland 8e2107a57d Add -Wno-declaration-after-statement to silence warnings that only apply to pre-C99 (#2345) 2023-03-22 20:03:17 -07:00
Sparkle-Bot 631846cc82 Update Package management files for version 2.4.0 2023-03-19 14:48:24 +00:00
Zorg 3a99b31f37 Add plain-text embedded release notes support for sparkle-cli (#2344) 2023-03-18 22:20:30 -07:00
Zorg 151c256721 Update changelog for adding plain text release notes view 2023-03-18 21:30:42 -07:00
Zorg 82b94a131d Fix name reference in changelog 2023-03-18 21:14:34 -07:00
Sparkle-Bot 4ac6ea827a Update Package management files for version 2.4.0-beta.2 2023-03-13 03:05:11 +00:00
Zorg b5199e7a05 Update changelog for Sparkle 2.4 again 2023-03-12 19:53:37 -07:00
Zorg 39495fd562 Remove redundant codesign check (#2341) 2023-03-12 19:44:50 -07:00
Zorg 60568b82ba Don't allow DSA-only updates to pass if DSA is disabled (#2340) 2023-03-12 07:59:03 -07:00
Zorg 9ab2c0d58c Hide impractical compression options only useful for debugging (#2335) 2023-03-04 18:03:45 -08:00
Zorg 665bba36cc Fix documentation formatting (#2334) 2023-03-04 16:02:03 -08:00
48 changed files with 444 additions and 277 deletions

No files matched your search

+46 -3
View File
@@ -350,12 +350,55 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
return;
}
// Resolve the bookmark data for the downloaded update
BOOL isStale = NO;
NSError *bookmarkError = nil;
NSURL *downloadURL = [NSURL URLByResolvingBookmarkData:installationData.updateURLBookmarkData options:NSURLBookmarkResolutionWithoutUI relativeToURL:nil bookmarkDataIsStale:&isStale error:&bookmarkError];
if (downloadURL == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to resolve bookmark data from downloaded update", NSUnderlyingErrorKey: bookmarkError }]];
return;
}
// Validate the download URL before moving it
{
NSArray<NSString *> *downloadURLPathComponents = downloadURL.URLByResolvingSymlinksInPath.pathComponents;
if (downloadURLPathComponents == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to retrieve path components from download URL" }]];
return;
}
if ([downloadURLPathComponents containsObject:@".."]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: download URL path components contains '..' which is unsafe" }]];
return;
}
if (![downloadURLPathComponents containsObject:@SPARKLE_BUNDLE_IDENTIFIER] || ![downloadURLPathComponents containsObject:@"PersistentDownloads"]) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: download URL path components does not contain PersistentDownloads or "@SPARKLE_BUNDLE_IDENTIFIER }]];
return;
}
}
if (!isStale) {
SULog(SULogLevelError, @"Error: bookmark data for update download is stale.. but still continuing.");
}
NSString *downloadName = downloadURL.lastPathComponent;
if (downloadName == nil) {
[self cleanupAndExitWithStatus:EXIT_FAILURE error:[NSError errorWithDomain:SUSparkleErrorDomain code:SPUInstallerError userInfo:@{ NSLocalizedDescriptionKey: @"Error: Failed to retrieve download name from download URL" }]];
return;
}
// Move the download archive to somewhere where probably only we will be touching it
// This prevents eg: if a bug exists in the updater that removes files we are trying to install
// When this tool is ran as root, we are moving it into a directory that only root will have access to
NSURL *downloadURL = [[NSURL fileURLWithPath:installationData.updateDirectoryPath] URLByAppendingPathComponent:installationData.downloadName];
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:installationData.downloadName];
NSURL *downloadDestinationURL = [[NSURL fileURLWithPath:cacheInstallationPath] URLByAppendingPathComponent:downloadName];
NSError *moveError = nil;
if (![[[SUFileManager alloc] init] moveItemAtURL:downloadURL toURL:downloadDestinationURL error:&moveError]) {
@@ -389,7 +432,7 @@ static const NSTimeInterval SUDisplayProgressTimeDelay = 0.7;
// Some of our properties may slightly differ than our input and we don't want to make the mistake of using one of those
self->_installationType = installationType;
self->_relaunchPath = installationData.relaunchPath;
self->_downloadName = installationData.downloadName;
self->_downloadName = downloadName;
self->_signatures = installationData.signatures;
self->_updateDirectoryPath = cacheInstallationPath;
self->_host = [[SUHost alloc] initWithBundle:hostBundle];
+2 -3
View File
@@ -22,12 +22,11 @@ SPU_OBJC_DIRECT_MEMBERS @interface SPUInstallationInputData : NSObject <NSSecure
* signatures - signatures for the update that came from the appcast item
* decryptionPassword - optional decryption password for dmg archives
*/
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateURLBookmarkData:(NSData *)updateURLBookmarkData installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword;
@property (nonatomic, copy, readonly) NSString *relaunchPath;
@property (nonatomic, copy, readonly) NSString *hostBundlePath;
@property (nonatomic, copy, readonly) NSString *updateDirectoryPath;
@property (nonatomic, copy, readonly) NSString *downloadName;
@property (nonatomic, copy, readonly) NSData *updateURLBookmarkData;
@property (nonatomic, copy, readonly) NSString *installationType;
@property (nonatomic, readonly, nullable) SUSignatures *signatures; // nullable because although not using signatures is deprecated, it's still supported
@property (nonatomic, copy, readonly, nullable) NSString *decryptionPassword;
+8 -17
View File
@@ -14,8 +14,7 @@
static NSString *SURelaunchPathKey = @"SURelaunchPath";
static NSString *SUHostBundlePathKey = @"SUHostBundlePath";
static NSString *SUUpdateDirectoryPathKey = @"SUUpdateDirectoryPath";
static NSString *SUDownloadNameKey = @"SUDownloadName";
static NSString *SUUpdateURLBookmarkDataKey = @"SUUpdateURLBookmarkData";
static NSString *SUSignaturesKey = @"SUSignatures";
static NSString *SUDecryptionPasswordKey = @"SUDecryptionPassword";
static NSString *SUInstallationTypeKey = @"SUInstallationType";
@@ -24,20 +23,18 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
@synthesize relaunchPath = _relaunchPath;
@synthesize hostBundlePath = _hostBundlePath;
@synthesize updateDirectoryPath = _updateDirectoryPath;
@synthesize downloadName = _downloadName;
@synthesize updateURLBookmarkData = _updateURLBookmarkData;
@synthesize signatures = _signatures;
@synthesize decryptionPassword = _decryptionPassword;
@synthesize installationType = _installationType;
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateDirectoryPath:(NSString *)updateDirectoryPath downloadName:(NSString *)downloadName installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
- (instancetype)initWithRelaunchPath:(NSString *)relaunchPath hostBundlePath:(NSString *)hostBundlePath updateURLBookmarkData:(NSData *)updateURLBookmarkData installationType:(NSString *)installationType signatures:(SUSignatures * _Nullable)signatures decryptionPassword:(nullable NSString *)decryptionPassword
{
self = [super init];
if (self != nil) {
_relaunchPath = [relaunchPath copy];
_hostBundlePath = [hostBundlePath copy];
_updateDirectoryPath = [updateDirectoryPath copy];
_downloadName = [downloadName copy];
_updateURLBookmarkData = updateURLBookmarkData;
_installationType = [installationType copy];
assert(SPUValidInstallationType(_installationType));
@@ -60,13 +57,8 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
return nil;
}
NSString *updateDirectoryPath = [decoder decodeObjectOfClass:[NSString class] forKey:SUUpdateDirectoryPathKey];
if (updateDirectoryPath == nil) {
return nil;
}
NSString *downloadName = [decoder decodeObjectOfClass:[NSString class] forKey:SUDownloadNameKey];
if (downloadName == nil) {
NSData *updateURLBookmarkData = [decoder decodeObjectOfClass:[NSData class] forKey:SUUpdateURLBookmarkDataKey];
if (updateURLBookmarkData == nil) {
return nil;
}
@@ -82,16 +74,15 @@ static NSString *SUInstallationTypeKey = @"SUInstallationType";
NSString *decryptionPassword = [decoder decodeObjectOfClass:[NSString class] forKey:SUDecryptionPasswordKey];
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateDirectoryPath:updateDirectoryPath downloadName:downloadName installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
return [self initWithRelaunchPath:relaunchPath hostBundlePath:hostBundlePath updateURLBookmarkData:updateURLBookmarkData installationType:installationType signatures:signatures decryptionPassword:decryptionPassword];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
[coder encodeObject:_relaunchPath forKey:SURelaunchPathKey];
[coder encodeObject:_hostBundlePath forKey:SUHostBundlePathKey];
[coder encodeObject:_updateDirectoryPath forKey:SUUpdateDirectoryPathKey];
[coder encodeObject:_updateURLBookmarkData forKey:SUUpdateURLBookmarkDataKey];
[coder encodeObject:_installationType forKey:SUInstallationTypeKey];
[coder encodeObject:_downloadName forKey:SUDownloadNameKey];
[coder encodeObject:_signatures forKey:SUSignaturesKey];
if (_decryptionPassword != nil) {
[coder encodeObject:_decryptionPassword forKey:SUDecryptionPasswordKey];
+3 -2
View File
@@ -52,9 +52,10 @@ extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionLatest;
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirst;
extern SUBinaryDeltaMajorVersion SUBinaryDeltaMajorVersionFirstSupported;
#define COMPRESSION_METHOD_ARGUMENT_DESCRIPTION @"The compression method to use for generating delta updates. Supported methods for version 3 delta files are 'lzma', 'bzip2', 'zlib', 'lzfse', 'lz4', 'none', and 'default'. Note that version 2 delta files only support 'bzip2', 'none', and 'default' so other methods will be ignored if version 2 files are being generated. The 'default' compression for version 3 delta files is currently lzma."
// Additional compression methods for version 3 patches that we have for debugging are zlib, bzip2, none
#define COMPRESSION_METHOD_ARGUMENT_DESCRIPTION @"The compression method to use for generating delta updates. Supported methods for version 3 delta files are 'lzma' (best compression, slowest), 'lzfse' (good compression, fast), 'lz4' (worse compression, fastest), and 'default'. Note that version 2 delta files only support 'bzip2', and 'default' so other methods will be ignored if version 2 files are being generated. The 'default' compression for version 3 delta files is currently lzma."
#define COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION @"The compression level to use for generating delta updates. This only applies if the compression method used is bzip2 which accepts values from 1 - 9. A special value of 0 will use the default compression level."
//#define COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION @"The compression level to use for generating delta updates. This only applies if the compression method used is bzip2 which accepts values from 1 - 9. A special value of 0 will use the default compression level."
SPUDeltaCompressionMode deltaCompressionModeFromDescription(NSString *description, BOOL *requestValid);
NSString *deltaCompressionStringFromMode(SPUDeltaCompressionMode mode);
+1 -1
View File
@@ -16,7 +16,7 @@ SPU_OBJC_DIRECT_MEMBERS
#endif
@interface SUCodeSigningVerifier : NSObject
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)newBundleURL andMatchesSignatureAtBundleURL:(NSURL *)oldBundleURL error:(NSError **)error;
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)bundleURL checkNestedCode:(BOOL)checkNestedCode error:(NSError **)error;
+2 -2
View File
@@ -17,7 +17,7 @@
@implementation SUCodeSigningVerifier
+ (BOOL)codeSignatureAtBundleURL:(NSURL *)oldBundleURL matchesSignatureAtBundleURL:(NSURL *)newBundleURL error:(NSError * __autoreleasing *)error
+ (BOOL)codeSignatureIsValidAtBundleURL:(NSURL *)newBundleURL andMatchesSignatureAtBundleURL:(NSURL *)oldBundleURL error:(NSError * __autoreleasing *)error
{
OSStatus result;
SecRequirementRef requirement = NULL;
@@ -148,7 +148,7 @@ finally:
goto finally;
}
// See in -codeSignatureAtBundleURL:matchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed
// See in -codeSignatureIsValidAtBundleURL:andMatchesSignatureAtBundleURL:error: for why kSecCSCheckNestedCode is not always passed
SecCSFlags flags = (SecCSFlags) (kSecCSDefaultFlags | kSecCSCheckAllArchitectures);
if (checkNestedCode) {
flags |= kSecCSCheckNestedCode;
+14
View File
@@ -241,6 +241,20 @@
}
}
}
#else
switch (_pubKeys.dsaPubKeyStatus) {
case SUSigningInputStatusAbsent:
break;
case SUSigningInputStatusInvalid:
// We don't keep track of DSA signatures, so we will ignore this mistake and treat it as if it were absent
break;
case SUSigningInputStatusPresent:
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"The old app has a DSA public key but DSA support is disabled, and the old app does not have an EdDSA public key." }];
}
return NO;
}
#endif
if (error != NULL) {
+1 -1
View File
@@ -20,7 +20,7 @@ struct Create: ParsableCommand {
@Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "compression"))
var compression: String = "default"
@Option(name: .long, help: ArgumentHelp(COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION, valueName: "compression-level"))
@Option(name: .long, help: .hidden)
var compressionLevel: UInt8 = 0
@Argument(help: ArgumentHelp("Path to original bundle to create a patch from."))
+21 -6
View File
@@ -1,17 +1,32 @@
# 2.4.2
* Ignore release notes download when we shouldn't show release notes (#2381) (Zorg)
* Fix NSKeyedUnarchiver warning for not specifying keyed NSString class (#2381) (Zorg)
* Harden verification of Sparkle update download (#2392) (Zorg)
# 2.4.1
* Remove auxiliary apps and relocate symbols in SPM package to resolve missing AvailableLibraries warnings (#2356) (Zorg)
* Add -Wno-declaration-after-statement to silence warnings that only apply to pre-C99 (#2345) (Kent Sutherland)
* Fix compile error when setting SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE=0 (#2346) (Zorg)
* Improve how downloaded update is passed to the installer (#2359) (Zorg)
# 2.4.0
* Ask permission for automatically downloading and installing new updates (#2285) (Zorg)
* Update `SUVersionDisplay` to better customize and display how versions are shown (#2321) (Zorg)
* Reduce code size
* Enable deployment postprocessing in Release to properly strip debug symbols and strip all non-global symbols (#2286, #2305) (Zerg)
* Enable deployment postprocessing in Release to properly strip debug symbols and strip all non-global symbols (#2286, #2305) (Zorg)
* Remove duplicate Sparkle localization strings in Updater app (#2288) (Zorg)
* Optimize codebase for generated code size (less properties, direct methods, etc) (#2305) (Zorg)
* Add additional settings to `ConfigCommon.xcconfig` for disabling features
* Add deprecations/warnings for incorrect update checking usage (#2295) (Zorg)
* Ask permission for automatically downloading and installing new updates (#2285) (Zorg)
* Add support for plain text release notes view that does not use web view (#2315) (Zorg)
* Update `SUVersionDisplay` to better customize and display how versions are shown (#2321) (Zorg)
* Add deprecations/warnings for incorrect background update checking usage (#2295) (Zorg)
* Deprecate `-[SPUUpdater setFeedURL:]` API and add `-[SPUUpdater clearFeedURLFromUserDefaults]` for migrating away from `-[SPUUpdater setFeedURL:]` (#2295)
* Exit with an error if generate_appcast cannot sign an update that must be signed (#2322) (Zorg)
* Trigger a new update check in `-[SPUUpdater resetUpdateCycle]` if the updater's feed or allowed channels have changed (#2324) (Zorg)
* Turn off autolinking for XPC targets to alleviate circular dependency issues (#2332) (Daniel Jalkut)
* Exit with an error if generate_appcast cannot sign an update that must be signed (#2322) (Zorg)
* Remove a redundant Apple code signing check when verifying new updates (#2341) (Zorg)
* Turn off auto-linking for XPC targets to alleviate circular dependency issues (#2332) (Daniel Jalkut)
# 2.3.2
+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"}
{"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"}
+18 -7
View File
@@ -12,9 +12,17 @@ SPARKLE_EMBED_INSTALLER_CONNECTION_XPC_SERVICE = 0
// Set to 0 to disable building legacy 1.x SUUpdater stub
SPARKLE_BUILD_LEGACY_SUUPDATER = 1
// Set to 0 to not build legacy DSA signing support (useful for migrating to EdDSA)
// Set to 0 to not build legacy DSA signing support
// Don't disable this if you haven't migrated to EdDSA yet or if you support updating
// other developer's applications that haven't migrated to EdDSA yet
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
SPARKLE_BUILD_LEGACY_DSA_SUPPORT = 1
// Set to 0 to not build legacy DSA signing support for generate_appcast
// Don't disable this if you still have items in your appcast feed that still need DSA signatures
// If this is disabled, this requires an update to OTHER_SWIFT_FLAGS_COMMON below
GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT = 1
// Set to 0 to not build legacy / xar based delta update support
SPARKLE_BUILD_LEGACY_DELTA_SUPPORT = 1
@@ -22,9 +30,11 @@ SPARKLE_BUILD_LEGACY_DELTA_SUPPORT = 1
SPARKLE_BUILD_BZIP2_DELTA_SUPPORT = 1
// Set to 0 to not build support for package (pkg) based installations
// 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)
@@ -35,9 +45,10 @@ SPARKLE_COPY_LOCALIZATIONS = 1
// Compilation flags for Swift tools and unit tests
// 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
// If SPARKLE_BUILD_DMG_SUPPORT is set to 0, remove -DSPARKLE_BUILD_DMG_SUPPORT
OTHER_SWIFT_FLAGS_COMMON = -DSPARKLE_BUILD_LEGACY_DSA_SUPPORT -DSPARKLE_BUILD_PACKAGE_SUPPORT -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
@@ -80,12 +91,12 @@ SPARKLE_ICON_NAME = AppIcon
// These variables must have a space after the '=' too
SPARKLE_VERSION_MAJOR = 2
SPARKLE_VERSION_MINOR = 4
SPARKLE_VERSION_PATCH = 0
SPARKLE_VERSION_PATCH = 2
// This should be in SemVer format or empty, ie. "-beta.1"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX = -beta.1
CURRENT_PROJECT_VERSION = 2023
SPARKLE_VERSION_SUFFIX =
CURRENT_PROJECT_VERSION = 2028
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO
@@ -95,7 +106,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_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) 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_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_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
@@ -150,4 +161,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 -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 -Werror=undef
+18 -7
View File
@@ -5,6 +5,7 @@ set -e
# This guards against our archives being corrupt / created incorrectly.
function verify_code_signatures() {
verification_directory="$1"
check_aux_apps="$2"
if [[ -z "$verification_directory" ]]; then
echo "Provided verification directory does not exist" >&2
@@ -13,8 +14,11 @@ function verify_code_signatures() {
# Search the current directory for all instances of the framework to verify them (XCFrameworks can have multiple copies of a framework for different platforms).
find "${verification_directory}" -name "Sparkle.framework" -type d -exec codesign --verify -vvv --deep {} \;
codesign --verify -vvv --deep "${verification_directory}/sparkle.app"
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
if [ "$check_aux_apps" = true ] ; then
codesign --verify -vvv --deep "${verification_directory}/sparkle.app"
codesign --verify -vvv --deep "${verification_directory}/Sparkle Test App.app"
fi
codesign --verify -vvv --deep "${verification_directory}/bin/BinaryDelta"
codesign --verify -vvv --deep "${verification_directory}/bin/generate_appcast"
codesign --verify -vvv --deep "${verification_directory}/bin/sign_update"
@@ -38,9 +42,7 @@ if [ "$ACTION" = "" ] ; then
cp "$CONFIGURATION_BUILD_DIR/generate_keys" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp "$CONFIGURATION_BUILD_DIR/sign_update" "$CONFIGURATION_BUILD_DIR/staging/bin"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework" "$CONFIGURATION_BUILD_DIR/staging"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.xcframework" "$CONFIGURATION_BUILD_DIR/staging-spm"
@@ -58,19 +60,28 @@ if [ "$ACTION" = "" ] ; then
# because missing dSYMs in a release build SHOULD trigger a build failure
if [ "$CONFIGURATION" = "Release" ] ; then
cp -R "$CONFIGURATION_BUILD_DIR/BinaryDelta.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/generate_appcast.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/generate_keys.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/sign_update.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle Test App.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/sparkle.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Sparkle.framework.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Autoupdate.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/Updater.app.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/${INSTALLER_LAUNCHER_NAME}.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
cp -R "$CONFIGURATION_BUILD_DIR/${DOWNLOADER_NAME}.xpc.dSYM" "$CONFIGURATION_BUILD_DIR/staging/Symbols"
fi
cp -R "$CONFIGURATION_BUILD_DIR/staging/bin" "$CONFIGURATION_BUILD_DIR/staging-spm"
cp -R "$CONFIGURATION_BUILD_DIR/staging/Symbols" "$CONFIGURATION_BUILD_DIR/staging-spm"
cd "$CONFIGURATION_BUILD_DIR/staging"
@@ -102,7 +113,7 @@ if [ "$ACTION" = "" ] ; then
# Test code signing validity of the extracted products
# This guards against our archives being corrupt / created incorrectly
verify_code_signatures "/tmp/sparkle-extract"
verify_code_signatures "/tmp/sparkle-extract" true
rm -rf "/tmp/sparkle-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging"
@@ -122,7 +133,7 @@ if [ "$ACTION" = "" ] ; then
# Test code signing validity of the extracted Swift package
# This guards against our archives being corrupt / created incorrectly
ditto -x -k "../Sparkle-for-Swift-Package-Manager.zip" "/tmp/sparkle-spm-extract"
verify_code_signatures "/tmp/sparkle-spm-extract"
verify_code_signatures "/tmp/sparkle-spm-extract" false
rm -rf "/tmp/sparkle-spm-extract"
rm -rf "$CONFIGURATION_BUILD_DIR/staging-spm"
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Deleting old products
rm -rd "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive"
rm -rd "$BUILT_PRODUCTS_DIR/Sparkle.xcframework"
xcodebuild archive -scheme Sparkle -archivePath "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive" BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO
if [ $XCODE_VERSION_MAJOR -ge "1200" ]; then
xcodebuild -create-xcframework -framework "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Autoupdate.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Updater.app.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Installer.xpc.dSYM" -debug-symbols "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Downloader.xpc.dSYM" -output "$BUILT_PRODUCTS_DIR/Sparkle.xcframework"
else
echo "warning: Your Xcode version does not support bundling dSYMs in XCFrameworks directly. You should copy them manually into the XCFramework."
echo "note: cp '$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM' '$BUILT_PRODUCTS_DIR/Sparkle.xcframework/your_architecture/dSYMs'"
xcodebuild -create-xcframework -framework "$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework" -output "$BUILT_PRODUCTS_DIR/Sparkle.xcframework"
fi
+22 -6
View File
@@ -106,20 +106,21 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
- (NSString *)rootPersistentDownloadCachePathForBundleIdentifier:(NSString *)bundleIdentifier SPU_OBJC_DIRECT
{
// Note: The installer verifies this "PersistentDownloads" path component
return [[SPULocalCacheDirectory cachePathForBundleIdentifier:bundleIdentifier] stringByAppendingPathComponent:@"PersistentDownloads"];
}
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier
- (void)removeDownloadDirectoryWithDownloadToken:(NSString *)downloadToken bundleIdentifier:(NSString *)bundleIdentifier
{
// Only take the directory name and compute most of the base path ourselves
// Only take the directory name (from the download token) and compute most of the base path ourselves
// This way we do not have to send/trust an absolute path
// 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(), ^{
NSString *rootPersistentDownloadCachePath = [self rootPersistentDownloadCachePathForBundleIdentifier:bundleIdentifier];
if (rootPersistentDownloadCachePath != nil) {
NSString *sanitizedDirectoryName = directoryName.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDirectoryName];
NSString *sanitizedDownloadToken = downloadToken.lastPathComponent;
NSString *tempDir = [rootPersistentDownloadCachePath stringByAppendingPathComponent:sanitizedDownloadToken];
[[NSFileManager defaultManager] removeItemAtPath:tempDir error:NULL];
}
@@ -201,8 +202,23 @@ static NSString *SUDownloadingReason = @"Downloading update related file";
NSError *error = nil;
if ([[NSFileManager defaultManager] moveItemAtPath:fromPath toPath:toPath error:&error]) {
_downloadFilename = toPath;
[_delegate downloaderDidSetDestinationName:name temporaryDirectory:downloadFileNameDirectory];
[self downloadDidFinish];
// Create a bookmark for the download
// Don't pass any options (we don't want a persistent security scoped bookmark)
NSURL *downloadURL = [NSURL fileURLWithPath:toPath isDirectory:NO];
NSError *bookmarkError = nil;
NSData *bookmarkData = [downloadURL bookmarkDataWithOptions:0 includingResourceValuesForKeys:@[] relativeToURL:nil error:&bookmarkError];
if (bookmarkData == nil) {
[_delegate downloaderDidFailWithError:bookmarkError];
} else {
// The download token may be provided later to the downloader for removing a download
// and its temporary directory
NSString *downloadToken = tempDir.lastPathComponent;
[_delegate downloaderDidSetDownloadBookmarkData:bookmarkData downloadToken:downloadToken];
[self downloadDidFinish];
}
} else {
[_delegate downloaderDidFailWithError:error];
}
+1 -1
View File
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol SPUDownloaderDelegate <NSObject>
// This is only invoked for persistent downloads
- (void)downloaderDidSetDestinationName:(NSString *)destinationName temporaryDirectory:(NSString *)temporaryDirectory;
- (void)downloaderDidSetDownloadBookmarkData:(NSData *)downloadBookmarkData downloadToken:(NSString *)downloadToken;
// Under rare cases, this may be called more than once, in which case the current progress should be reset back to 0
// This is only invoked for persistent downloads
+1 -1
View File
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)startTemporaryDownloadWithRequest:(NSURLRequest *)request;
- (void)removeDownloadDirectory:(NSString *)directoryName bundleIdentifier:(NSString *)bundleIdentifier;
- (void)removeDownloadDirectoryWithDownloadToken:(NSString *)downloadToken bundleIdentifier:(NSString *)bundleIdentifier;
- (void)cleanup:(void (^)(void))completionHandler;
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "2.4.0-beta.1"
let version = "2.4.2"
// 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.4.0-beta.1"
let checksum = "db183f67aa093d4f42afe41fc601d075ec04bafa62c5d171b77106707345d5da"
let tag = "2.4.2"
let checksum = "012b639ae96e0768135495a7dfcc3dfcd4cc51d076191b55445e3da3e37fdd43"
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.4.0-beta.1"
s.version = "2.4.2"
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"
+11 -1
View File
@@ -407,6 +407,8 @@
72E45CF81B640DAE005C701A /* SUUpdateSettingsWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */; };
72E45CFC1B641961005C701A /* sparkletestcast.xml in Resources */ = {isa = PBXBuildFile; fileRef = 72E45CFB1B641961005C701A /* sparkletestcast.xml */; };
72E539121D68C3FA0092CE5E /* SPUDownloadData.m in Sources */ = {isa = PBXBuildFile; fileRef = 72F9EC431D5E9ED8004AC8B6 /* SPUDownloadData.m */; };
72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */; };
72EB736129BEB36100FBCEE7 /* DevSignedAppVersion2.zip in Resources */ = {isa = PBXBuildFile; fileRef = 72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */; };
72EB87EA1CB8798800C37F42 /* ShowInstallerProgress.m in Sources */ = {isa = PBXBuildFile; fileRef = 72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */; };
72EB87EB1CB8859100C37F42 /* Updater.app in Copy Tools */ = {isa = PBXBuildFile; fileRef = 721C24451CB753E6005440CB /* Updater.app */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
72EB87EC1CB8887E00C37F42 /* SUStatus.xib in Resources */ = {isa = PBXBuildFile; fileRef = 55C14BD8136EF00C00649790 /* SUStatus.xib */; };
@@ -1084,6 +1086,7 @@
722FB7E4260EE53F00EB571C /* SUNormalization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SUNormalization.m; sourceTree = "<group>"; };
72316BD11E0DA8430039EFD9 /* SUUnarchiverNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUnarchiverNotifier.h; path = Autoupdate/SUUnarchiverNotifier.h; sourceTree = SOURCE_ROOT; };
72316BD21E0DA8430039EFD9 /* SUUnarchiverNotifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUUnarchiverNotifier.m; path = Autoupdate/SUUnarchiverNotifier.m; sourceTree = SOURCE_ROOT; };
7235B75E29DFC0120081FE4E /* make-xcframework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "make-xcframework.sh"; sourceTree = "<group>"; };
723ABCD7259A9A9D00BDB4FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Sparkle.strings; sourceTree = "<group>"; };
723ABD37259A9BA500BDB4FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SUUpdateAlert.xib; sourceTree = "<group>"; };
723ABD4C259A9BB900BDB4FA /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/SUUpdateAlert.strings; sourceTree = "<group>"; };
@@ -1410,6 +1413,8 @@
72E45CF51B640DAE005C701A /* SUUpdateSettingsWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SUUpdateSettingsWindowController.m; sourceTree = "<group>"; };
72E45CF61B640DAE005C701A /* SUUpdateSettingsWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SUUpdateSettingsWindowController.xib; sourceTree = "<group>"; };
72E45CFB1B641961005C701A /* sparkletestcast.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = sparkletestcast.xml; sourceTree = "<group>"; };
72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = DevSignedApp.zip; sourceTree = "<group>"; };
72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */ = {isa = PBXFileReference; lastKnownFileType = archive.zip; path = DevSignedAppVersion2.zip; sourceTree = "<group>"; };
72EB87E91CB8798800C37F42 /* ShowInstallerProgress.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ShowInstallerProgress.m; path = Sparkle/InstallerProgress/ShowInstallerProgress.m; sourceTree = SOURCE_ROOT; };
72EE17FA26D1CBC000C58B19 /* SUInstallerLauncher+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SUInstallerLauncher+Private.h"; sourceTree = "<group>"; };
72EE181826DAE6E100C58B19 /* SPUUpdateCheck.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SPUUpdateCheck.h; sourceTree = "<group>"; };
@@ -1847,6 +1852,8 @@
729F7ECD27409076004592DC /* SparkleTestCodeSignApp_bad_extraneous.zip */,
72CCDEBD27421FD500B53718 /* SparkleTestCodeSignApp_bad_header.zip */,
F8761EB21ADC50EB000C9034 /* SparkleTestCodeSignApp.zip */,
72EB735E29BE981300FBCEE7 /* DevSignedApp.zip */,
72EB736029BEB36100FBCEE7 /* DevSignedAppVersion2.zip */,
14958C6C19AEBC610061B14F /* test-pubkey.pem */,
5AF6C74E1AEA46D10014A3AB /* test.pkg */,
5AD0FA7E1C73F2E2004BCEFF /* testappcast.xml */,
@@ -2489,6 +2496,7 @@
EA1E285722B6622E004AA304 /* ed25519-Release.xcconfig */,
EA1E285922B6622E004AA304 /* ed25519-Shared.xcconfig */,
14732BC91960F70A00593899 /* make-release-package.sh */,
7235B75E29DFC0120081FE4E /* make-xcframework.sh */,
14652F7919A93E5F00959E44 /* set-git-version-info.sh */,
72045CE426FEE708004F96E5 /* strip-framework.sh */,
720C192827127A3800740C8E /* release-move-tag.sh */,
@@ -3139,6 +3147,7 @@
725B3A82263FBF0C0041AB8E /* testappcast_minimumAutoupdateVersion.xml in Resources */,
14958C6E19AEBC950061B14F /* signed-test-file.txt in Resources */,
723AD12F29922B5F006BB02F /* test-dangerous-link.xml in Resources */,
72EB736129BEB36100FBCEE7 /* DevSignedAppVersion2.zip in Resources */,
723EDC3F26885A8E000BCBA4 /* testappcast_channels.xml in Resources */,
720DC50427A51A6500DFF3EC /* testappcast_minimumAutoupdateVersionSkipping.xml in Resources */,
72AC6B2E1B9B218C00F62325 /* SparkleTestCodeSignApp.dmg in Resources */,
@@ -3153,6 +3162,7 @@
5A5DD40424958B000045EB3E /* SUUpdateValidatorTest in Resources */,
14958C6F19AEBC980061B14F /* test-pubkey.pem in Resources */,
5AF6C74F1AEA46D10014A3AB /* test.pkg in Resources */,
72EB735F29BE981300FBCEE7 /* DevSignedApp.zip in Resources */,
72BC6C3D275027BF0083F14B /* SparkleTestCodeSign_apfs.dmg in Resources */,
720DC50627A62CDC00DFF3EC /* testappcast_minimumAutoupdateVersionSkipping2.xml in Resources */,
5AD0FA7F1C73F2E2004BCEFF /* testappcast.xml in Resources */,
@@ -3313,7 +3323,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Deleting old products\nrm -rd \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive\"\nrm -rd \"$BUILT_PRODUCTS_DIR/Sparkle.xcframework\"\n\nxcodebuild archive -scheme Sparkle -archivePath \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive\" BUILD_LIBRARY_FOR_DISTRIBUTION=YES SKIP_INSTALL=NO\n\nif [ $XCODE_VERSION_MAJOR -ge \"1200\" ]; then\nxcodebuild -create-xcframework -framework \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework\" -debug-symbols \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM\" -output \"$BUILT_PRODUCTS_DIR/Sparkle.xcframework\"\nelse\necho \"warning: Your Xcode version does not support bundling dSYMs in XCFrameworks directly. You should copy them manually into the XCFramework.\"\necho \"note: cp '$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/dSYMs/Sparkle.framework.dSYM' '$BUILT_PRODUCTS_DIR/Sparkle.xcframework/your_architecture/dSYMs'\"\nxcodebuild -create-xcframework -framework \"$BUILT_PRODUCTS_DIR/Sparkle.xcarchive/Products/Library/Frameworks/Sparkle.framework\" -output \"$BUILT_PRODUCTS_DIR/Sparkle.xcframework\"\nfi\n";
shellScript = "\"$SRCROOT/Configurations/make-xcframework.sh\"\n";
};
/* End PBXShellScriptBuildPhase section */
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" 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="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" 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="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
+9 -13
View File
@@ -35,8 +35,8 @@
SUAppcastItem *_updateItem;
SUAppcastItem * _Nullable _secondaryUpdateItem;
SUHost *_host;
NSString *_temporaryDirectory;
NSString *_downloadName;
NSData *_downloadBookmarkData;
NSString *_downloadToken;
__weak id<SPUDownloadDriverDelegate> _delegate;
@@ -169,12 +169,7 @@
NSString *bundleIdentifier = _host.bundle.bundleIdentifier;
assert(bundleIdentifier != nil);
if (bundleIdentifier != nil) {
// Grab eg "0bCSun8tj" from org.sparkle-project.Sparkle/PersistentDownloads/0bCSun8tj/Sparkle Test App 2.0/
NSString *tempDirectoryName = downloadedUpdate.temporaryDirectory.stringByDeletingLastPathComponent.lastPathComponent;
[_downloader removeDownloadDirectory:tempDirectoryName bundleIdentifier:bundleIdentifier];
}
[_downloader removeDownloadDirectoryWithDownloadToken:downloadedUpdate.downloadToken bundleIdentifier:bundleIdentifier];
}
- (void)cleanup:(void (^)(void))completionHandler
@@ -188,7 +183,8 @@
self->_connection = nil;
}
#endif
self->_downloadName = nil;
self->_downloadBookmarkData = nil;
self->_downloadToken = nil;
self->_downloader = nil;
completionHandler();
@@ -216,7 +212,7 @@
SULog(SULogLevelError, @"Warning: Downloader's expected content length (%llu) != Appcast item's length (%llu)", self->_expectedContentLength, self->_updateItem.contentLength);
}
SPUDownloadedUpdate *downloadedUpdate = [[SPUDownloadedUpdate alloc] initWithAppcastItem:self->_updateItem secondaryAppcastItem:self->_secondaryUpdateItem downloadName:self->_downloadName temporaryDirectory:self->_temporaryDirectory];
SPUDownloadedUpdate *downloadedUpdate = [[SPUDownloadedUpdate alloc] initWithAppcastItem:self->_updateItem secondaryAppcastItem:self->_secondaryUpdateItem downloadBookmarkData:self->_downloadBookmarkData downloadToken:self->_downloadToken];
if ([delegate respondsToSelector:@selector(downloadDriverDidDownloadUpdate:)]) {
[delegate downloadDriverDidDownloadUpdate:downloadedUpdate];
@@ -254,11 +250,11 @@
});
}
- (void)downloaderDidSetDestinationName:(NSString *)destinationName temporaryDirectory:(NSString *)temporaryDirectory
- (void)downloaderDidSetDownloadBookmarkData:(NSData *)downloadBookmarkData downloadToken:(NSString *)downloadToken
{
dispatch_async(dispatch_get_main_queue(), ^{
self->_downloadName = destinationName;
self->_temporaryDirectory = temporaryDirectory;
self->_downloadBookmarkData = downloadBookmarkData;
self->_downloadToken = [downloadToken copy];
});
}
+3 -3
View File
@@ -13,10 +13,10 @@ NS_ASSUME_NONNULL_BEGIN
SPU_OBJC_DIRECT_MEMBERS @interface SPUDownloadedUpdate : NSObject <SPUResumableUpdate>
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryItem downloadBookmarkData:(NSData *)downloadBookmarkData downloadToken:(NSString *)downloadToken;
@property (nonatomic, copy, readonly) NSString *downloadName;
@property (nonatomic, copy, readonly) NSString *temporaryDirectory;
@property (nonatomic, readonly) NSData *downloadBookmarkData;
@property (nonatomic, readonly) NSString *downloadToken;
@end
+5 -5
View File
@@ -18,17 +18,17 @@
@synthesize updateItem = _updateItem;
@synthesize secondaryUpdateItem = _secondaryUpdateItem;
@synthesize downloadName = _downloadName;
@synthesize temporaryDirectory = _temporaryDirectory;
@synthesize downloadBookmarkData = _downloadBookmarkData;
@synthesize downloadToken = _downloadToken;
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem downloadName:(NSString *)downloadName temporaryDirectory:(NSString *)temporaryDirectory
- (instancetype)initWithAppcastItem:(SUAppcastItem *)updateItem secondaryAppcastItem:(SUAppcastItem * _Nullable)secondaryUpdateItem downloadBookmarkData:(NSData *)downloadBookmarkData downloadToken:(NSString *)downloadToken
{
self = [super init];
if (self != nil) {
_updateItem = updateItem;
_secondaryUpdateItem = secondaryUpdateItem;
_downloadName = [downloadName copy];
_temporaryDirectory = [temporaryDirectory copy];
_downloadBookmarkData = downloadBookmarkData;
_downloadToken = [downloadToken copy];
}
return self;
}
+6 -6
View File
@@ -49,8 +49,7 @@
NSBundle *_applicationBundle;
id<SUInstallerConnectionProtocol> _installerConnection;
SUAppcastItem *_updateItem;
NSString *_downloadName;
NSString *_temporaryDirectory;
NSData *_updateURLBookmarkData;
NSError *_installerError;
__weak id _updater;
@@ -191,8 +190,7 @@
- (void)extractDownloadedUpdate:(SPUDownloadedUpdate *)downloadedUpdate silently:(BOOL)silently completion:(void (^)(NSError * _Nullable))completionHandler
{
_updateItem = downloadedUpdate.updateItem;
_temporaryDirectory = downloadedUpdate.temporaryDirectory;
_downloadName = downloadedUpdate.downloadName;
_updateURLBookmarkData = downloadedUpdate.downloadBookmarkData;
_currentStage = SPUInstallerNotStarted;
@@ -237,11 +235,13 @@
}
#endif
SPUInstallationInputData *installationData = [[SPUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:_host.bundlePath updateDirectoryPath:_temporaryDirectory downloadName:_downloadName installationType:_updateItem.installationType signatures:_updateItem.signatures decryptionPassword:decryptionPassword];
id<SPUInstallerDriverDelegate> delegate = _delegate;
SPUInstallationInputData *installationData = [[SPUInstallationInputData alloc] initWithRelaunchPath:pathToRelaunch hostBundlePath:_host.bundlePath updateURLBookmarkData:_updateURLBookmarkData installationType:_updateItem.installationType signatures:_updateItem.signatures decryptionPassword:decryptionPassword];
NSData *archivedData = SPUArchiveRootObjectSecurely(installationData);
if (archivedData == nil) {
[_delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:@"An error occurred while encoding the installer parameters. Please try again later." }]];
[delegate installerIsRequestingAbortInstallWithError:[NSError errorWithDomain:SUSparkleErrorDomain code:SUInstallationError userInfo:@{ NSLocalizedDescriptionKey:@"An error occurred while encoding the installer parameters. Please try again later." }]];
return;
}
+4 -4
View File
@@ -225,7 +225,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
Note that the developer can disallow automatic downloading of updates from being enabled (via `SUAllowsAutomaticUpdates` Info.plist key).
In this case, this property will return NO regardless of how this property is set.
Prefer to set SUAutomaticallyUpdate directly in your Info.plist for setting the initial value.
Prefer to set `SUAutomaticallyUpdate` directly in your Info.plist for setting the initial value.
Setting this property will persist in the host bundle's user defaults.
Hence developers shouldn't maintain an additional user default for this property.
@@ -301,7 +301,7 @@ SU_EXPORT @interface SPUUpdater : NSObject
The user agent used when checking for updates.
By default the user agent string returned is in the format:
$(BundleDisplayName)/$(BundleDisplayVersion) Sparkle/$(SparkleDisplayVersion)
`$(BundleDisplayName)/$(BundleDisplayVersion) Sparkle/$(SparkleDisplayVersion)`
BundleDisplayVersion is derived from the main application's Info.plist's CFBundleShortVersionString.
@@ -339,9 +339,9 @@ SU_EXPORT @interface SPUUpdater : NSObject
This method should only be called in response to a user changing updater settings. This method may trigger a new update check to occur in the background if an updater setting such as the updater's feed or allowed channels has changed.
If the `updateCheckInterval` or `automaticallyChecksForUpdates` properties are changed, this method is automatically invoked after a short delay using `resetUpdateCycleAfterShortDelay`. In these cases, manually resetting the update cycle is not necessary.
If the `updateCheckInterval` or `automaticallyChecksForUpdates` properties are changed, this method is automatically invoked after a short delay using `-resetUpdateCycleAfterShortDelay`. In these cases, manually resetting the update cycle is not necessary.
See also `resetUpdateCycleAfterShortDelay` which gives the user a short delay before triggering a cycle reset.
See also `-resetUpdateCycleAfterShortDelay` which gives the user a short delay before triggering a cycle reset.
*/
- (void)resetUpdateCycle;
+1 -1
View File
@@ -96,7 +96,7 @@ static NSString *SUAppcastItemDeltaFromSparkleLocalesKey = @"SUAppcastItemDeltaF
self = [super init];
if (self != nil) {
_deltaUpdates = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [SUAppcastItem class]]] forKey:SUAppcastItemDeltaUpdatesKey];
_deltaUpdates = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [SUAppcastItem class], [NSString class]]] forKey:SUAppcastItemDeltaUpdatesKey];
_deltaFromSparkleExecutableSize = [decoder decodeObjectOfClass:[NSNumber class] forKey:SUAppcastItemDeltaFromSparkleExecutableSizeKey];
_deltaFromSparkleLocales = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSSet class], [NSString class]]] forKey:SUAppcastItemDeltaFromSparkleLocalesKey];
-3
View File
@@ -45,11 +45,8 @@ extern NSString *const SUSkippedMajorVersionKey;
extern NSString *const SUSkippedMajorSubreleaseVersionKey;
extern NSString *const SUScheduledCheckIntervalKey;
extern NSString *const SULastCheckTimeKey;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
extern NSString *const SUExpectsDSASignatureKey;
extern NSString *const SUPublicDSAKeyKey;
extern NSString *const SUPublicDSAKeyFileKey;
#endif
extern NSString *const SUPublicEDKeyKey;
extern NSString *const SUAutomaticallyUpdateKey;
extern NSString *const SUAllowsAutomaticUpdatesKey;
+1 -4
View File
@@ -41,11 +41,8 @@ NSString *const SUSkippedMajorVersionKey = @"SUSkippedMajorVersion";
NSString *const SUSkippedMajorSubreleaseVersionKey = @"SUSkippedMajorSubreleaseVersion";
NSString *const SUScheduledCheckIntervalKey = @"SUScheduledCheckInterval";
NSString *const SULastCheckTimeKey = @"SULastCheckTime";
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
NSString *const SUExpectsDSASignatureKey = @"SUExpectsDSASignature";
NSString *const SUPublicDSAKeyKey = @"SUPublicDSAKey";
NSString *const SUPublicDSAKeyFileKey = @"SUPublicDSAKeyFile";
#endif
NSString *const SUPublicEDKeyKey = @"SUPublicEDKey";
NSString *const SUAutomaticallyUpdateKey = @"SUAutomaticallyUpdate";
NSString *const SUAllowsAutomaticUpdatesKey = @"SUAllowsAutomaticUpdates";
@@ -75,7 +72,7 @@ NSString *const SURelaunchToolNameKey = @"SURelaunchToolName";
NSString *const SUAppcastAttributeDeltaFrom = @"sparkle:deltaFrom";
NSString *const SUAppcastAttributeDeltaFromSparkleExecutableSize = @"sparkle:deltaFromSparkleExecutableSize";
NSString *const SUAppcastAttributeDeltaFromSparkleLocales = @"sparkle:deltaFromSparkleLocales";
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT || GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
NSString *const SUAppcastAttributeDSASignature = @"sparkle:dsaSignature";
#endif
NSString *const SUAppcastAttributeEDSignature = @"sparkle:edSignature";
-2
View File
@@ -31,9 +31,7 @@ SPU_OBJC_DIRECT_MEMBERS
@property (getter=isRunningOnReadOnlyVolume, nonatomic, readonly) BOOL runningOnReadOnlyVolume;
@property (getter=isRunningTranslocated, nonatomic, readonly) BOOL runningTranslocated;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
@property (readonly, nonatomic, copy, nullable) NSString *publicDSAKeyFileKey;
#endif
- (nullable id)objectForInfoDictionaryKey:(NSString *)key;
- (BOOL)boolForInfoDictionaryKey:(NSString *)key;
+1 -8
View File
@@ -135,7 +135,6 @@ NS_ASSUME_NONNULL_BEGIN
return [self objectForInfoDictionaryKey:SUPublicEDKeyKey];
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (NSString *_Nullable)publicDSAKey SPU_OBJC_DIRECT
{
// Maybe the key is just a string in the Info.plist.
@@ -161,23 +160,17 @@ NS_ASSUME_NONNULL_BEGIN
}
return key;
}
#endif
- (SUPublicKeys *)publicKeys
{
return [[SUPublicKeys alloc] initWithEd:[self publicEDKey]
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:[self publicDSAKey]
#endif
];
dsa:[self publicDSAKey]];
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (NSString * _Nullable)publicDSAKeyFileKey
{
return [self objectForInfoDictionaryKey:SUPublicDSAKeyFileKey];
}
#endif
- (nullable id)objectForInfoDictionaryKey:(NSString *)key
{
-4
View File
@@ -47,10 +47,8 @@ SPU_OBJC_DIRECT_MEMBERS
#endif
@interface SUPublicKeys : NSObject
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
@property (nonatomic, readonly, nullable) NSString *dsaPubKey;
@property (nonatomic, readonly) SUSigningInputStatus dsaPubKeyStatus;
#endif
@property (nonatomic, readonly, nullable) const unsigned char *ed25519PubKey;
@property (nonatomic, readonly) SUSigningInputStatus ed25519PubKeyStatus;
@@ -59,9 +57,7 @@ SPU_OBJC_DIRECT_MEMBERS
@property (nonatomic, readonly) BOOL hasAnyKeys;
- (instancetype)initWithEd:(NSString * _Nullable)ed
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:(NSString * _Nullable)dsa
#endif
;
@end
+2 -14
View File
@@ -150,21 +150,15 @@ static BOOL decodeStatus(NSCoder *decoder, NSString *key, SUSigningInputStatus *
unsigned char _ed25519_public_key[32];
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
@synthesize dsaPubKey = _dsaPubKey;
#endif
@synthesize ed25519PubKeyStatus = _ed25519PubKeyStatus;
- (instancetype)initWithEd:(NSString * _Nullable)maybeEd25519
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:(NSString * _Nullable)maybeDsa
#endif
{
self = [super init];
if (self) {
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
_dsaPubKey = maybeDsa;
#endif
if (maybeEd25519 != nil) {
NSData *ed = nil;
_ed25519PubKeyStatus = decode(maybeEd25519, &ed);
@@ -185,13 +179,11 @@ static BOOL decodeStatus(NSCoder *decoder, NSString *key, SUSigningInputStatus *
return self;
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (SUSigningInputStatus)dsaPubKeyStatus {
// We don't currently do any prevalidation of DSA public keys,
// so this is always going to be "present" or "absent".
return (_dsaPubKey != nil) ? SUSigningInputStatusPresent : SUSigningInputStatusAbsent;
}
#endif
- (const unsigned char *)ed25519PubKey {
if (_ed25519PubKeyStatus == SUSigningInputStatusPresent) {
@@ -201,12 +193,8 @@ static BOOL decodeStatus(NSCoder *decoder, NSString *key, SUSigningInputStatus *
}
- (BOOL)hasAnyKeys {
return
_ed25519PubKeyStatus != SUSigningInputStatusAbsent
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
|| [self dsaPubKeyStatus] != SUSigningInputStatusAbsent
#endif
;
return (_ed25519PubKeyStatus != SUSigningInputStatusAbsent) ||
([self dsaPubKeyStatus] != SUSigningInputStatusAbsent);
}
@end
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" 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="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
+13 -4
View File
@@ -241,6 +241,13 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
- (void)showUpdateReleaseNotesWithDownloadData:(SPUDownloadData *)downloadData
{
if (![self showsReleaseNotes]) {
if ([_host.bundle isEqual:NSBundle.mainBundle]) {
SULog(SULogLevelError, @"Warning: '%@' is configured to not show release notes but release notes for version %@ were downloaded. Consider either removing release notes from your appcast or implementing -[SPUUpdaterDelegate updater:shouldDownloadReleaseNotesForUpdate:]", _host.name, _updateItem.displayVersionString);
}
return;
}
NSURL *releaseNotesURL = _updateItem.releaseNotesURL;
NSURL *baseURL = releaseNotesURL.URLByDeletingLastPathComponent;
// If a MIME type isn't provided, we will pick html as the default, as opposed to plain text. Questionable decision..
@@ -322,17 +329,19 @@ static NSString *const SUUpdateAlertTouchBarIndentifier = @"" SPARKLE_BUNDLE_IDE
BOOL javaScriptEnabled = [_host boolForInfoDictionaryKey:SUEnableJavaScriptKey];
#if DOWNLOADER_XPC_SERVICE_EMBEDDED
// WKWebView has a bug where it won't work in loading local HTML content in sandboxed apps that do not have an outgoing network entitlement
// FB6993802: https://twitter.com/sindresorhus/status/1160577243929878528 | https://github.com/feedback-assistant/reports/issues/1
// If the developer is using the downloader XPC service, they are very most likely are a) sandboxed b) do not use outgoing network entitlement.
// In this case, fall back to legacy WebKit view.
// (In theory it is possible for a non-sandboxed app or sandboxed app with outgoing network entitlement to use the XPC service, it's just pretty unlikely. And falling back to a legacy web view would not be too harmful in those cases).
BOOL useWKWebView = !SPUXPCServiceIsEnabled(SUEnableDownloaderServiceKey);
if (useWKWebView) {
_releaseNotesView = [[SUWKWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled];
} else {
if (!useWKWebView) {
_releaseNotesView = [[SULegacyWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled];
} else
#endif
{
_releaseNotesView = [[SUWKWebView alloc] initWithColorStyleSheetLocation:colorStyleURL fontFamily:defaultFontFamily fontPointSize:defaultFontSize javaScriptEnabled:javaScriptEnabled];
}
}
+4 -18
View File
@@ -154,29 +154,14 @@
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
SUPublicKeys *newPublicKeys = newHost.publicKeys;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
BOOL oldHasLegacyDSAKey = publicKeys.dsaPubKeyStatus != SUSigningInputStatusAbsent;
#endif
BOOL oldHasEdDSAKey = publicKeys.ed25519PubKeyStatus != SUSigningInputStatusAbsent;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
BOOL oldHasAnyDSAKey = oldHasLegacyDSAKey || oldHasEdDSAKey;
#else
BOOL oldHasAnyDSAKey = oldHasEdDSAKey;
#endif
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
BOOL newHasLegacyDSAKey = newPublicKeys.dsaPubKeyStatus != SUSigningInputStatusAbsent;
#endif
BOOL newHasEdDSAKey = newPublicKeys.ed25519PubKeyStatus != SUSigningInputStatusAbsent;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
BOOL newHasAnyDSAKey = newHasLegacyDSAKey || newHasEdDSAKey;
#else
BOOL newHasAnyDSAKey = newHasEdDSAKey;
#endif
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
BOOL migratesDSAKeys = oldHasLegacyDSAKey && !oldHasEdDSAKey && newHasEdDSAKey && !newHasLegacyDSAKey;
#else
BOOL migratesDSAKeys = NO;
#endif
BOOL updateIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:newHost.bundle.bundleURL];
BOOL hostIsCodeSigned = [SUCodeSigningVerifier bundleAtURLIsCodeSigned:host.bundle.bundleURL];
@@ -200,7 +185,7 @@
NSError *codeSignedError = nil;
if (hostIsCodeSigned) {
passedCodeSigning = [SUCodeSigningVerifier codeSignatureAtBundleURL:host.bundle.bundleURL matchesSignatureAtBundleURL:newHost.bundle.bundleURL error:&codeSignedError];
passedCodeSigning = [SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL andMatchesSignatureAtBundleURL:host.bundle.bundleURL error:&codeSignedError];
}
// End of security-critical part
@@ -216,8 +201,9 @@
}
}
// If the new update is code signed but it's not validly code signed, we reject it
NSError *innerError = nil;
if (passedDSACheck && updateIsCodeSigned && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL error:&innerError]) {
if (passedDSACheck && updateIsCodeSigned && !passedCodeSigning && ![SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:newHost.bundle.bundleURL error:&innerError]) {
if (error != NULL) {
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUValidationError userInfo:@{ NSLocalizedDescriptionKey: @"The update archive has a valid (Ed)DSA signature, but the app is also signed with Code Signing, which is corrupted. The update will be rejected.", NSUnderlyingErrorKey: innerError }];
}
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21507" 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="21507"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21701"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Binary file not shown.
Binary file not shown.
+96 -60
View File
@@ -12,13 +12,6 @@
#import "SUAdHocCodeSigning.h"
#import "SUFileManager.h"
#if defined(__MAC_10_15)
// In macOS 10.15 and later, pre-installed apps are installed under the System folder
#define CALCULATOR_PATH @"/System/Applications/Calculator.app"
#else
#define CALCULATOR_PATH @"/Applications/Calculator.app"
#endif
@interface SUCodeSigningVerifierTest : XCTestCase
@end
@@ -27,14 +20,9 @@
NSURL *_notSignedAppURL;
NSURL *_validSignedAppURL;
NSURL *_invalidSignedAppURL;
NSURL *_calculatorCopyURL;
}
+ (NSString *)calculatorApplicationPath
{
NSString *applicationsDirectory = [NSSearchPathForDirectoriesInDomains(NSApplicationDirectory, NSSystemDomainMask, NO) objectAtIndex:0];
NSString *calculatorPath = [applicationsDirectory stringByAppendingPathComponent:@"Calculator.app"];
return calculatorPath;
NSURL *_devSignedAppURL;
NSURL *_devSignedVersion2AppURL;
NSURL *_devInvalidSignedAppURL;
}
- (void)setUp
@@ -58,9 +46,9 @@
if ([[NSFileManager defaultManager] createDirectoryAtURL:tempDir withIntermediateDirectories:YES attributes:nil error:&error]) {
if ([self unzip:zippedAppURL toPath:tempDir.path]) {
_notSignedAppURL = [tempDir URLByAppendingPathComponent:@"SparkleTestCodeSignApp.app"];
[self setupValidSignedApp];
[self setupCalculatorCopy];
[self setupInvalidSignedApp];
[self setUpValidSignedApp];
[self setUpDevSignedApps];
[self setUpInvalidSignedApp];
}
else {
NSLog(@"Failed to unzip %@", zippedAppURL);
@@ -81,7 +69,7 @@
}
}
- (void)setupValidSignedApp
- (void)setUpValidSignedApp
{
NSError *error = nil;
NSURL *tempDir = [_notSignedAppURL URLByDeletingLastPathComponent];
@@ -99,38 +87,48 @@
}
}
- (void)setupCalculatorCopy
- (void)setUpDevSignedApps
{
NSURL *tempDir = [_notSignedAppURL URLByDeletingLastPathComponent];
NSURL *calculatorCopy = [tempDir URLByAppendingPathComponent:@"calc.app"];
NSURL *devSignedAppURL = [tempDir URLByAppendingPathComponent:@"DevSignedApp.app"];
NSURL *devSignedAppVersion2URL = [tempDir URLByAppendingPathComponent:@"DevSignedAppVersion2.app"];
NSURL *devInvalidSignedAppURL = [tempDir URLByAppendingPathComponent:@"DevInvalidSignedApp.app"];
_devSignedAppURL = devSignedAppURL;
_devSignedVersion2AppURL = devSignedAppVersion2URL;
_devInvalidSignedAppURL = devInvalidSignedAppURL;
[[NSFileManager defaultManager] removeItemAtURL:calculatorCopy error:NULL];
[[NSFileManager defaultManager] removeItemAtURL:devSignedAppURL error:NULL];
[[NSFileManager defaultManager] removeItemAtURL:devSignedAppVersion2URL error:NULL];
[[NSFileManager defaultManager] removeItemAtURL:devInvalidSignedAppURL error:NULL];
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
// Make a copy of the signed calculator app so we can match signatures later
// Make a copy of a signed devID app so we can match signatures later
// Matching signatures on ad-hoc signed apps does *not* work
NSError *copyError = nil;
// Don't check the return value of this operation - seems like on 10.11 the API can say it fails even though the operation really succeeds,
// which sounds like some kind of (SIP / attribute?) bug
[[NSFileManager defaultManager] copyItemAtURL:[NSURL fileURLWithPath:calculatorPath] toURL:calculatorCopy error:&copyError];
if (![calculatorCopy checkResourceIsReachableAndReturnError:nil]) {
XCTFail(@"Copied calculator application does not exist");
NSBundle *unitTestBundle = [NSBundle bundleForClass:[self class]];
{
NSString *zippedAppURL = [unitTestBundle pathForResource:@"DevSignedApp" ofType:@"zip"];
if ([self unzip:zippedAppURL toPath:tempDir.path]) {
BOOL copiedApp = [[NSFileManager defaultManager] copyItemAtURL:devSignedAppURL toURL:devInvalidSignedAppURL error:NULL];
XCTAssertTrue(copiedApp);
BOOL wroteData = [[NSData data] writeToURL:(NSURL * _Nonnull)[devInvalidSignedAppURL URLByAppendingPathComponent:@"Contents/Resources/foo"] atomically:YES];
XCTAssertTrue(wroteData);
} else {
XCTFail(@"Failed to unzip dev signed app");
}
}
// Alter the signed copy slightly, this won't invalidate signature matching (although it will invalidate the integrity part of the signature)
// Which is what we want. If a user alters an app bundle, we should still be able to update as long as its identity is still valid
NSError *removeError = nil;
NSURL *calculatorPkgInfo = [[calculatorCopy URLByAppendingPathComponent:@"Contents"] URLByAppendingPathComponent:@"PkgInfo"];
XCTAssertNotNil(calculatorPkgInfo);
if (![[NSFileManager defaultManager] removeItemAtURL:calculatorPkgInfo error:&removeError]) {
XCTFail(@"Failed to remove file in calculator copy with error: %@", removeError);
{
NSString *zippedAppURL = [unitTestBundle pathForResource:@"DevSignedAppVersion2" ofType:@"zip"];
if (![self unzip:zippedAppURL toPath:tempDir.path]) {
XCTFail(@"Failed to unzip dev signed app");
}
}
_calculatorCopyURL = calculatorCopy;
}
- (void)setupInvalidSignedApp
- (void)setUpInvalidSignedApp
{
NSError *error = nil;
NSURL *tempDir = [_notSignedAppURL URLByDeletingLastPathComponent];
@@ -198,41 +196,79 @@
XCTAssertNil(error, @"error should be nil");
}
- (void)testValidSignedCalculatorApp
- (void)testValidSignedDevIdApp
{
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
XCTAssertTrue([SUCodeSigningVerifier bundleAtURLIsCodeSigned:appPath], @"App expected to be code signed");
XCTAssertTrue([SUCodeSigningVerifier bundleAtURLIsCodeSigned:_devSignedAppURL], @"App expected to be code signed");
XCTAssertTrue([SUCodeSigningVerifier bundleAtURLIsCodeSigned:_devSignedVersion2AppURL], @"App expected to be code signed");
{
NSError *error = nil;
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devSignedAppURL error:&error], @"signature should be valid");
XCTAssertNil(error, @"error should be nil");
}
{
NSError *error = nil;
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devSignedVersion2AppURL error:&error], @"signature should be valid");
XCTAssertNil(error, @"error should be nil");
}
}
- (void)testInvalidSignedDevIdApp
{
XCTAssertTrue([SUCodeSigningVerifier bundleAtURLIsCodeSigned:_devInvalidSignedAppURL], @"App expected to be code signed");
NSError *error = nil;
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:appPath error:&error], @"signature should be valid");
XCTAssertNil(error, @"error should be nil");
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devInvalidSignedAppURL error:&error], @"signature should be invalid");
XCTAssertNotNil(error, @"error should be not be nil");
}
- (void)testValidMatchingSelf
{
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
NSError *error = nil;
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
XCTAssertTrue([SUCodeSigningVerifier codeSignatureAtBundleURL:appPath matchesSignatureAtBundleURL:appPath error:&error], @"Our valid signed app expected to having matching signature to itself");
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devSignedAppURL andMatchesSignatureAtBundleURL:_devSignedAppURL error:&error], @"Our valid signed app expected to having matching signature to itself");
}
- (void)testValidMatching
- (void)testValidMatchingDevIdApp
{
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
// We can't test our own app because matching with ad-hoc signed apps understandably does not succeed
NSError *error = nil;
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
XCTAssertTrue([SUCodeSigningVerifier codeSignatureAtBundleURL:appPath matchesSignatureAtBundleURL:_calculatorCopyURL error:&error], @"The calculator app is expected to have matching identity signature to its altered copy");
{
NSError *error = nil;
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devSignedAppURL andMatchesSignatureAtBundleURL:_devSignedVersion2AppURL error:&error], @"The dev ID signed app is expected to have a matching identity signature to a newer version");
XCTAssertNil(error);
}
{
NSError *error = nil;
XCTAssertTrue([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devSignedVersion2AppURL andMatchesSignatureAtBundleURL:_devSignedAppURL error:&error], @"The dev ID signed app is expected to have a matching identity signature to an older version");
XCTAssertNil(error);
}
}
- (void)testInvalidMatchingWithBrokenBundle
{
// We can't test our own app because matching with ad-hoc signed apps understandably does not succeed
{
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_devSignedAppURL andMatchesSignatureAtBundleURL:_invalidSignedAppURL error:&error], @"The dev ID signed app is expected to not have a matching identity signature to its altered invalid copy");
XCTAssertNotNil(error);
}
{
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_invalidSignedAppURL andMatchesSignatureAtBundleURL:_devSignedAppURL error:&error], @"The invalid dev ID signed app is expected to not have a matching identity signature to the valid version");
XCTAssertNotNil(error);
}
}
- (void)testInvalidMatching
{
NSString *calculatorPath = [SUCodeSigningVerifierTest calculatorApplicationPath];
NSURL *appPath = [NSURL fileURLWithPath:calculatorPath];
NSError *error = nil;
XCTAssertFalse([SUCodeSigningVerifier codeSignatureAtBundleURL:appPath matchesSignatureAtBundleURL:_validSignedAppURL error:&error], @"Calculator app bundle expected to have different signature than our valid signed app");
XCTAssertFalse([SUCodeSigningVerifier codeSignatureIsValidAtBundleURL:_validSignedAppURL andMatchesSignatureAtBundleURL:_devSignedAppURL error:&error], @"Dev ID signed app bundle expected to have different signature than our adhoc valid signed app");
}
- (void)testInvalidSignedApp
+66 -42
View File
@@ -30,7 +30,6 @@
_pubEdKey = @"rhHib+w769W2/6/t+oM1ZxgjBB93BfBKMLO0Qo1etQs=";
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (void)testVerifyFileAtPathUsingDSA
{
NSString *pubKey = [NSString stringWithContentsOfFile:_pubDSAKeyFile encoding:NSASCIIStringEncoding error:nil];
@@ -40,11 +39,19 @@
NSError *error = nil;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
XCTAssertTrue([self checkFile:_testFile
withDSAKey:pubKey
signature:validSig
error:&error],
@"Expected valid signature: %@", error);
#else
XCTAssertFalse([self checkFile:_testFile
withDSAKey:pubKey
signature:validSig
error:&error],
@"Expected DSA verification to fail: %@", error);
#endif
XCTAssertFalse([self checkFile:_testFile
withDSAKey:@"lol"
@@ -64,11 +71,19 @@
error:&error],
@"Expected invalid signature: %@", error);
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
XCTAssertTrue([self checkFile:_testFile
withDSAKey:pubKey
signature:@"MC0CFAsKO7cq2q7L5/FWe6ybVIQkwAwSAhUA2Q8GKsE309eugi/v3Kh1W3w3N8c="
error:&error],
@"Expected valid signature: %@", error);
#else
XCTAssertFalse([self checkFile:_testFile
withDSAKey:pubKey
signature:@"MC0CFAsKO7cq2q7L5/FWe6ybVIQkwAwSAhUA2Q8GKsE309eugi/v3Kh1W3w3N8c="
error:&error],
@"Expected DSA verification to fail: %@", error);
#endif
XCTAssertFalse([self checkFile:_testFile
withDSAKey:pubKey
@@ -76,7 +91,6 @@
error:&error],
@"Expected invalid signature: %@", error);
}
#endif
- (void)testVerifyFileAtPathUsingED25519
{
@@ -115,38 +129,47 @@
@"Invalid signature: %@", error);
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (BOOL)checkFile:(NSString *)aFile withDSAKey:(NSString *)pubKey signature:(NSString *)sigString error:(NSError * __autoreleasing *)error
{
SUPublicKeys *pubKeys = [[SUPublicKeys alloc] initWithEd:nil dsa:pubKey];
SUSignatureVerifier *v = [[SUSignatureVerifier alloc] initWithPublicKeys:pubKeys];
SUSignatures *sig = [[SUSignatures alloc] initWithEd:nil dsa:sigString];
SUSignatures *sig = [[SUSignatures alloc] initWithEd:nil
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:sigString
#endif
];
return [v verifyFileAtPath:aFile signatures:sig error:error];
}
static SUSignatures *_createSignatures(NSString *edString, NSString *dsaString)
{
#if !SPARKLE_BUILD_LEGACY_DSA_SUPPORT
(void)dsaString;
#endif
SUSignatures *sig = [[SUSignatures alloc] initWithEd:edString
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:dsaString
#endif
];
return sig;
}
- (BOOL)checkFile:(NSString *)aFile withEdKey:(NSString *)pubKey signature:(NSString *)sigString error:(NSError * __autoreleasing *)error
{
SUPublicKeys *pubKeys = [[SUPublicKeys alloc] initWithEd:pubKey
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:nil
#endif
];
dsa:nil];
SUSignatureVerifier *v = [[SUSignatureVerifier alloc] initWithPublicKeys:pubKeys];
SUSignatures *sig = [[SUSignatures alloc] initWithEd:sigString
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:nil
#endif
];
SUSignatures *sig = _createSignatures(sigString, nil);
return [v verifyFileAtPath:aFile signatures:sig error:error];
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (void)testVerifyFileWithBothKeys
{
NSString *dsaKey = [NSString stringWithContentsOfFile:_pubDSAKeyFile encoding:NSASCIIStringEncoding error:nil];
@@ -157,10 +180,10 @@
NSError *error = nil;
XCTAssertFalse([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:nil dsa:nil] error:&error],
signatures:_createSignatures(nil, nil) error:&error],
@"Fail if no signatures are provided: %@", error);
XCTAssertFalse([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:@"lol" dsa:@"lol"] error:&error],
signatures:_createSignatures(@"lol", @"lol") error:&error],
@"Fail if both signatures are invalid: %@", error);
NSString *dsaSig = @"MCwCFCIHCIYYkfZavNzTitTW5tlRp/k5AhQ40poFytqcVhIYdCxQznaXeJPJDQ==";
@@ -169,38 +192,43 @@
NSString *wrongEdSig = @"wTcpXCgWoa4NrJpsfzS61FXJIbv963//12U2ef9xstzVOLPHYK2N4/ojgpDV5N1/NGG1uWMBgK+kEWp0Z5zMDQ==";
XCTAssertFalse([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:nil dsa:dsaSig] error:&error],
signatures:_createSignatures(nil, dsaSig) error:&error],
@"EdDSA signature must be present if app has EdDSA key: %@", error);
XCTAssertTrue([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:edSig dsa:nil] error:&error],
signatures:_createSignatures(edSig, nil) error:&error],
@"Allow just an EdDSA signature if that's all that's available: %@", error);
XCTAssertFalse([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:wrongEdSig dsa:dsaSig] error:&error],
signatures:_createSignatures(wrongEdSig, dsaSig) error:&error],
@"Fail on a bad Ed25519 signature regardless: %@", error);
XCTAssertTrue([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:edSig dsa:wrongDSASig] error:&error],
signatures:_createSignatures(edSig, wrongDSASig) error:&error],
@"Allow bad DSA signature if EdDSA signature is good: %@", error);
XCTAssertFalse([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:@"lol" dsa:dsaSig] error:&error],
signatures:_createSignatures(@"lol", dsaSig) error:&error],
@"Fail if the Ed25519 signature is invalid: %@", error);
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
XCTAssertFalse([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:edSig dsa:@"lol"] error:&error],
signatures:_createSignatures(edSig, @"lol") error:&error],
@"Fail if invalid DSA signature is used even if EdDSA signature is good: %@", error);
#else
XCTAssertTrue([v verifyFileAtPath:_testFile
signatures:_createSignatures(edSig, @"lol") error:&error],
@"Allow invalid DSA signature if EdDSA signature is good: %@", error);
#endif
XCTAssertTrue([v verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:edSig dsa:dsaSig] error:&error],
signatures:_createSignatures(edSig, dsaSig) error:&error],
@"Pass if both are valid: %@", error);
}
#endif
- (void)testVerifyFileWithWrongKey
{
NSError *error = nil;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
NSString *dsaSig = @"MCwCFCIHCIYYkfZavNzTitTW5tlRp/k5AhQ40poFytqcVhIYdCxQznaXeJPJDQ==";
NSString *edSig = @"EIawm2YkDZ2gBfkEMF2+1VuuTeXnCGZOdnMdVgPPvDZioq7bvDayXqKkIIzSjKMmeFdcFJOHdnba5ZV60+gPBw==";
@@ -211,23 +239,15 @@
SUSignatureVerifier *dsaOnlyVerifier = [[SUSignatureVerifier alloc] initWithPublicKeys:dsaOnlyKeys];
XCTAssertFalse([dsaOnlyVerifier verifyFileAtPath:_testFile
signatures:[[SUSignatures alloc] initWithEd:edSig dsa:nil] error:&error],
signatures:_createSignatures(edSig, nil) error:&error],
@"DSA cannot verify an Ed signature: %@", error);
#endif
SUPublicKeys *edOnlyKeys = [[SUPublicKeys alloc] initWithEd:_pubEdKey
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:nil
#endif
];
dsa:nil];
SUSignatureVerifier *edOnlyVerifier = [[SUSignatureVerifier alloc] initWithPublicKeys:edOnlyKeys];
{
SUSignatures *signatures = [[SUSignatures alloc] initWithEd:nil
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
dsa:dsaSig
#endif
];
SUSignatures *signatures = _createSignatures(nil, dsaSig);
XCTAssertFalse([edOnlyVerifier verifyFileAtPath:_testFile
signatures:signatures
error:&error],
@@ -236,7 +256,6 @@
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
- (void)testValidatePath
{
NSString *dsaStr = [NSString stringWithContentsOfFile:_pubDSAKeyFile encoding:NSASCIIStringEncoding error:nil];
@@ -245,13 +264,18 @@
XCTAssertNotNil(pubkeys);
XCTAssertNotNil(pubkeys.dsaPubKey);
SUSignatures *sig = [[SUSignatures alloc] initWithEd:nil dsa:@"MC0CFFMF3ha5kjvrJ9JTpTR8BenPN9QUAhUAzY06JRdtP17MJewxhK0twhvbKIE="];
SUSignatures *sig = _createSignatures(nil, @"MC0CFFMF3ha5kjvrJ9JTpTR8BenPN9QUAhUAzY06JRdtP17MJewxhK0twhvbKIE=");
XCTAssertNotNil(sig);
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
XCTAssertNotNil(sig.dsaSignature);
NSError *error = nil;
XCTAssertTrue([SUSignatureVerifier validatePath:_testFile withSignatures:sig withPublicKeys:pubkeys error:&error], @"Expected valid signature: %@", error);
}
#endif
NSError *error = nil;
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
XCTAssertTrue([SUSignatureVerifier validatePath:_testFile withSignatures:sig withPublicKeys:pubkeys error:&error], @"Expected valid signature: %@", error);
#else
XCTAssertFalse([SUSignatureVerifier validatePath:_testFile withSignatures:sig withPublicKeys:pubkeys error:&error], @"Expected verification to fail due to disabling DSA: %@", error);
#endif
}
@end
+8 -4
View File
@@ -12,9 +12,7 @@ import XCTest
class SUUpdateValidatorTest: XCTestCase {
enum BundleConfig: String, CaseIterable, Equatable {
case none = "None"
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
case dsaOnly = "DSAOnly"
#endif
case edOnly = "EDOnly"
case both = "Both"
case codeSignedOnly = "CodeSignedOnly"
@@ -31,10 +29,8 @@ class SUUpdateValidatorTest: XCTestCase {
return false
case .edOnly, .both, .codeSignedBoth, .codeSignedBothNew, .codeSignedOldED, .codeSignedInvalid:
return true
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
case .dsaOnly:
return true
#endif
}
}
}
@@ -129,6 +125,8 @@ class SUUpdateValidatorTest: XCTestCase {
#endif
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
testPrevalidation(bundle: .both, signatures: signatureConfig, expectedResult: signatureConfig.ed == .valid && signatureConfig.dsa != .invalidFormat)
#else
testPrevalidation(bundle: .both, signatures: signatureConfig, expectedResult: signatureConfig.ed == .valid)
#endif
}
}
@@ -166,6 +164,8 @@ class SUUpdateValidatorTest: XCTestCase {
#endif
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
testPostValidation(bundle: .both, signatures: signatureConfig, expectedResult: signatureConfig.ed == .valid && signatureConfig.dsa != .invalidFormat)
#else
testPostValidation(bundle: .both, signatures: signatureConfig, expectedResult: signatureConfig.ed == .valid)
#endif
}
}
@@ -188,6 +188,8 @@ class SUUpdateValidatorTest: XCTestCase {
for bundleConfig in BundleConfig.allCases {
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
testPostValidation(oldBundle: .dsaOnly, newBundle: bundleConfig, signatures: SignatureConfig(ed: .valid, dsa: .valid), expectedResult: bundleConfig.hasAnyKeys && bundleConfig != .codeSignedInvalid)
#else
testPostValidation(oldBundle: .dsaOnly, newBundle: bundleConfig, signatures: SignatureConfig(ed: .valid), expectedResult: false)
#endif
do {
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
@@ -199,6 +201,8 @@ class SUUpdateValidatorTest: XCTestCase {
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
testPostValidation(oldBundle: .both, newBundle: bundleConfig, signatures: SignatureConfig(ed: .valid, dsa: .valid), expectedResult: bundleConfig.hasAnyKeys && bundleConfig != .codeSignedInvalid)
#else
testPostValidation(oldBundle: .both, newBundle: bundleConfig, signatures: SignatureConfig(ed: .valid), expectedResult: bundleConfig.hasAnyKeys && bundleConfig != .codeSignedInvalid)
#endif
do {
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
+4 -4
View File
@@ -179,7 +179,7 @@ func makeAppcasts(archivesSourceDir: URL, outputPathURL: URL?, cacheDirectory ca
group.enter()
DispatchQueue.global().async {
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
if let privateDSAKey = keys.privateDSAKey {
do {
update.dsaSignature = try dsaSignature(path: update.archivePath, privateDSAKey: privateDSAKey)
@@ -273,7 +273,7 @@ func makeAppcasts(archivesSourceDir: URL, outputPathURL: URL?, cacheDirectory ca
print("Warning: New app is not code signed but older version (\(item)) is: \(latestItem)")
} else if oldAppCodeSigned && newAppCodeSigned {
do {
try SUCodeSigningVerifier.codeSignature(atBundleURL: item.appPath, matchesSignatureAtBundleURL: latestItem.appPath)
try SUCodeSigningVerifier.codeSignatureIsValid(atBundleURL: latestItem.appPath, andMatchesSignatureAtBundleURL: item.appPath)
} catch {
print("Warning: found mismatch code signing identity between \(item) and \(latestItem)")
}
@@ -343,7 +343,7 @@ func makeAppcasts(archivesSourceDir: URL, outputPathURL: URL?, cacheDirectory ca
group.enter()
DispatchQueue.global().async {
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
if item.supportsDSA, let privateDSAKey = keys.privateDSAKey {
do {
delta.dsaSignature = try dsaSignature(path: deltaPath, privateDSAKey: privateDSAKey)
@@ -361,7 +361,7 @@ func makeAppcasts(archivesSourceDir: URL, outputPathURL: URL?, cacheDirectory ca
}
do {
var hasAnyDSASignature = (delta.edSignature != nil)
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
hasAnyDSASignature = hasAnyDSASignature || (delta.dsaSignature != nil)
#endif
if hasAnyDSASignature {
+3 -3
View File
@@ -16,7 +16,7 @@ struct UpdateBranch: Hashable {
class DeltaUpdate {
let fromVersion: String
let archivePath: URL
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
var dsaSignature: String?
#endif
var edSignature: String?
@@ -77,7 +77,7 @@ class ArchiveItem: CustomStringConvertible {
let archiveFileAttributes: [FileAttributeKey: Any]
var deltas: [DeltaUpdate]
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
var dsaSignature: String?
#endif
var edSignature: String?
@@ -146,7 +146,7 @@ class ArchiveItem: CustomStringConvertible {
}
let shortVersion = infoPlist["CFBundleShortVersionString"] as? String
let publicEdKey = infoPlist[SUPublicEDKeyKey] as? String
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
let supportsDSA = infoPlist[SUPublicDSAKeyKey] != nil || infoPlist[SUPublicDSAKeyFileKey] != nil
#else
let supportsDSA = false
+2 -2
View File
@@ -448,7 +448,7 @@ func writeAppcast(appcastDestPath: URL, appcast: Appcast, fullReleaseNotesLink:
if let sig = update.edSignature {
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeEDSignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
if let sig = update.dsaSignature {
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeDSASignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
}
@@ -482,7 +482,7 @@ func writeAppcast(appcastDestPath: URL, appcast: Appcast, fullReleaseNotesLink:
if let sig = delta.edSignature {
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeEDSignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
}
#if SPARKLE_BUILD_LEGACY_DSA_SUPPORT
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
if let sig = delta.dsaSignature {
attributes.append(XMLNode.attribute(withName: SUAppcastAttributeDSASignature, uri: sparkleNS, stringValue: sig) as! XMLNode)
}
+2
View File
@@ -17,6 +17,7 @@ struct PrivateKeys {
}
}
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
func loadPrivateDSAKey(at privateKeyURL: URL) throws -> SecKey {
let data = try Data(contentsOf: privateKeyURL)
@@ -94,6 +95,7 @@ func dsaSignature(path: URL, privateDSAKey: SecKey) throws -> String {
}
return resultData.base64EncodedString()
}
#endif
func edSignature(path: URL, publicEdKey: Data, privateEdKey: Data) throws -> String {
assert(publicEdKey.count == 32)
+11 -1
View File
@@ -63,17 +63,21 @@ struct GenerateAppcast: ParsableCommand {
@Option(name: .customLong("ed-key-file"), help: ArgumentHelp("Path to the private EdDSA key file. If not specified, the private EdDSA key will be read from the Keychain instead. '-' can be used to echo the EdDSA key from a 'secret' environment variable to the standard input stream. For example: echo \"$PRIVATE_KEY_SECRET\" | ./\(programName) --ed-key-file -", valueName: "private-EdDSA-key-file"))
var privateEdKeyPath: String?
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
@Option(name: .customShort("f"), help: ArgumentHelp("Path to the private DSA key file. Only use this option for transitioning to EdDSA from older updates.", valueName: "private-dsa-key-file"), transform: { URL(fileURLWithPath: $0) })
var privateDSAKeyURL: URL?
@Option(name: .customShort("n"), help: ArgumentHelp("The name of the private DSA key. This option must be used together with `-k`. Only use this option for transitioning to EdDSA from older updates.", valueName: "dsa-key-name"))
var privateDSAKeyName: String?
#endif
@Option(name: .customShort("s"), help: ArgumentHelp("(DEPRECATED): The private EdDSA string (128 characters). This option is deprecated. Please use the Keychain, or pass the key as standard input when using the --ed-key-file - option instead.", valueName: "private-EdDSA-key"))
var privateEdString : String?
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
@Option(name: .customShort("k"), help: ArgumentHelp("The path to the keychain to look up the private DSA key. This option must be used together with `-n`. Only use this option for transitioning to EdDSA from older updates.", valueName: "keychain-for-dsa"), transform: { URL(fileURLWithPath: $0) })
var keychainURL: URL?
#endif
@Option(name: .customLong("download-url-prefix"), help: ArgumentHelp("A URL that will be used as prefix for the URL from where updates will be downloaded.", valueName: "url"), transform: { URL(string: $0) })
var downloadURLPrefix : URL?
@@ -108,7 +112,7 @@ struct GenerateAppcast: ParsableCommand {
@Option(name: .long, help: ArgumentHelp(COMPRESSION_METHOD_ARGUMENT_DESCRIPTION, valueName: "delta-compression"))
var deltaCompression: String = "default"
@Option(name: .long, help: ArgumentHelp(COMPRESSION_LEVEL_ARGUMENT_DESCRIPTION, valueName: "delta-compression-level"))
@Option(name: .long, help: .hidden)
var deltaCompressionLevel: UInt8 = 0
@Option(name: .long, help: ArgumentHelp("The Sparkle channel name that will be used for generating new updates. By default, no channel is used. Old applications need to be using Sparkle 2 to use this feature.", valueName: "channel-name"))
@@ -187,6 +191,7 @@ struct GenerateAppcast: ParsableCommand {
""")
func validate() throws {
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
guard (keychainURL == nil) == (privateDSAKeyName == nil) else {
throw ValidationError("Both -n <dsa-key-name> and -k <keychain> options must be provided together, or neither should be provided.")
}
@@ -195,6 +200,7 @@ struct GenerateAppcast: ParsableCommand {
guard (keychainURL == nil) || (privateDSAKeyURL == nil) else {
throw ValidationError("-f <private-dsa-key-file> cannot be provided if -n <dsa-key-name> and -k <keychain> is provided")
}
#endif
guard (privateEdKeyPath == nil) || (privateEdString == nil) else {
throw ValidationError("--ed-key-file <private-EdDSA-key-file> cannot be provided if -s <private-EdDSA-key> is provided")
@@ -224,6 +230,7 @@ struct GenerateAppcast: ParsableCommand {
func run() throws {
// Extract the keys
let privateDSAKey : SecKey?
#if GENERATE_APPCAST_BUILD_LEGACY_DSA_SUPPORT
if let privateDSAKeyURL = privateDSAKeyURL {
do {
privateDSAKey = try loadPrivateDSAKey(at: privateDSAKeyURL)
@@ -241,6 +248,9 @@ struct GenerateAppcast: ParsableCommand {
} else {
privateDSAKey = nil
}
#else
privateDSAKey = nil
#endif
let privateEdKeyString: String?
if let privateEdString = privateEdString {
+6 -1
View File
@@ -80,7 +80,12 @@
if (appcastItem.itemDescription != nil) {
NSData *descriptionData = [appcastItem.itemDescription dataUsingEncoding:NSUTF8StringEncoding];
if (descriptionData != nil) {
[self displayHTMLReleaseNotes:descriptionData];
NSString *itemDescriptionFormat = appcastItem.itemDescriptionFormat;
if (itemDescriptionFormat != nil && [itemDescriptionFormat isEqualToString:@"plain-text"]) {
[self displayPlainTextReleaseNotes:descriptionData encoding:NSUTF8StringEncoding];
} else {
[self displayHTMLReleaseNotes:descriptionData];
}
}
}
}