mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-25 04:47:55 +00:00
Add log warning for DSA deprecation and link to documentation (#1890)
This commit is contained in:
1 parent
d9d7e310a5
commit
9c360b465b
1 file changed
+19
-10
Vendored
+19
-10
@@ -61,7 +61,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@property (nonatomic, copy) NSDate *updateLastCheckedDate;
|
||||
|
||||
@property (nonatomic) BOOL loggedATSWarning;
|
||||
@property (nonatomic) BOOL loggedDSAWarning;
|
||||
@property (nonatomic) BOOL loggedNoSecureKeyWarning;
|
||||
|
||||
@end
|
||||
|
||||
@@ -84,7 +84,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
@synthesize showingPermissionRequest = _showingPermissionRequest;
|
||||
@synthesize updateLastCheckedDate = _updateLastCheckedDate;
|
||||
@synthesize loggedATSWarning = _loggedATSWarning;
|
||||
@synthesize loggedDSAWarning = _loggedDSAWarning;
|
||||
@synthesize loggedNoSecureKeyWarning = _loggedNoSecureKeyWarning;
|
||||
|
||||
#if DEBUG
|
||||
+ (void)load
|
||||
@@ -215,17 +215,18 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
}
|
||||
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundle];
|
||||
|
||||
if (feedURL != nil) {
|
||||
servingOverHttps = [[[feedURL scheme] lowercaseString] isEqualToString:@"https"];
|
||||
if (!servingOverHttps) {
|
||||
BOOL foundXPCPersistentDownloaderService = NO;
|
||||
BOOL foundATSPersistentIssue = [self checkATSIssueForBundle:SPUXPCServiceBundle(@DOWNLOADER_BUNDLE_ID) getBundleExists:&foundXPCPersistentDownloaderService];
|
||||
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
BOOL foundATSMainBundleIssue = NO;
|
||||
if (!foundATSPersistentIssue && !foundXPCPersistentDownloaderService) {
|
||||
BOOL foundATSIssue = ([mainBundle objectForInfoDictionaryKey:@"NSAppTransportSecurity"] == nil);
|
||||
BOOL updatingMainBundle = [self.host.bundle isEqualTo:mainBundle];
|
||||
|
||||
if (updatingMainBundle) {
|
||||
// The only way we'll know for sure if there is an issue is if the main bundle is the same as the one we're updating
|
||||
@@ -245,8 +246,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
}
|
||||
|
||||
BOOL hasPublicKey = self.host.publicKeys.hasAnyKeys;
|
||||
if (!hasPublicKey) {
|
||||
SUPublicKeys *publicKeys = self.host.publicKeys;
|
||||
BOOL hasAnyPublicKey = publicKeys.hasAnyKeys;
|
||||
if (!hasAnyPublicKey) {
|
||||
// If we failed to retrieve a DSA key but the bundle specifies a path to one, we should consider this a configuration failure
|
||||
NSString *publicDSAKeyFileKey = [self.host publicDSAKeyFileKey];
|
||||
if (publicDSAKeyFileKey != nil) {
|
||||
@@ -257,19 +259,26 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasPublicKey) {
|
||||
if (!hasAnyPublicKey) {
|
||||
if ((feedURL != nil && !servingOverHttps) || ![SUCodeSigningVerifier bundleAtURLIsCodeSigned:[[self hostBundle] bundleURL]]) {
|
||||
if (error != NULL) {
|
||||
*error = [NSError errorWithDomain:SUSparkleErrorDomain code:SUNoPublicDSAFoundError userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:@"For security reasons, updates need to be signed with an EdDSA key for %@. See Sparkle's documentation for more information.", hostName] }];
|
||||
}
|
||||
return NO;
|
||||
} else {
|
||||
if (!self.loggedDSAWarning) {
|
||||
SULog(SULogLevelDefault, @"DEPRECATION: Serving updates without an EdDSA key is now deprecated and may be removed from a future release. See Sparkle's documentation for more information.");
|
||||
if (updatingMainBundle && !self.loggedNoSecureKeyWarning) {
|
||||
SULog(SULogLevelError, @"Error: Serving updates without an EdDSA key and only using Apple Code Signing is deprecated and may be unsupported in a future release. Visit Sparkle's documentation for more information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns");
|
||||
|
||||
self.loggedDSAWarning = YES;
|
||||
self.loggedNoSecureKeyWarning = YES;
|
||||
}
|
||||
}
|
||||
} else if (publicKeys.ed25519PubKey == nil) {
|
||||
// No EdDSA key is available, so app must be using DSA
|
||||
if (updatingMainBundle && !self.loggedNoSecureKeyWarning) {
|
||||
SULog(SULogLevelError, @"Error: Serving updates without an EdDSA key is insecure and deprecated. DSA support may be removed in a future Sparkle release. Please migrate to using EdDSA (ed25519). Visit Sparkle's documentation for migration information: https://sparkle-project.org/documentation/#3-segue-for-security-concerns");
|
||||
|
||||
self.loggedNoSecureKeyWarning = YES;
|
||||
}
|
||||
}
|
||||
|
||||
// Check XPC Services are functional
|
||||
|
||||
Reference in new issue
Block a user