Compare commits

...
13 Commits
31 changed files with 276 additions and 201 deletions

No files matched your search

+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."))
+8 -6
View File
@@ -1,17 +1,19 @@
# 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"}
+18 -6
View File
@@ -9,12 +9,21 @@ SPARKLE_EMBED_DOWNLOADER_XPC_SERVICE = 1
SPARKLE_EMBED_INSTALLER_STATUS_XPC_SERVICE = 0
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 +31,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 +46,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
@@ -84,8 +96,8 @@ SPARKLE_VERSION_PATCH = 0
// This should be in SemVer format or empty, ie. "-beta.1"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX = -beta.1
CURRENT_PROJECT_VERSION = 2023
SPARKLE_VERSION_SUFFIX =
CURRENT_PROJECT_VERSION = 2025
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
ALWAYS_SEARCH_USER_PATHS = NO
@@ -95,7 +107,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 +162,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
+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.0"
// 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.0"
let checksum = "44c1a2da814ab922aaf754ed53cd9acb183fe61d43615d1ee83b5744d1533263"
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.0"
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"
+8
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 */; };
@@ -1410,6 +1412,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 +1851,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 */,
@@ -3139,6 +3145,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 +3160,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 */,
+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;
-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
+6 -4
View File
@@ -322,17 +322,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 }];
}
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];
}
}
}
}