Prevent public DSA key -> no public DSA key downgrade

This may prevent developers from making accidental downgrades.
This commit is contained in:
Zorg committed 2016-08-27 00:32:01 -04:00
1 parent 99f34299f1
commit e2fc8b4258
1 file changed
+6
+6
View File
@@ -317,6 +317,12 @@
SUHost *newHost = [[SUHost alloc] initWithBundle:newBundle];
NSString *newPublicDSAKey = newHost.publicDSAKey;
// Downgrade in DSA security should not be possible
if (publicDSAKey != nil && newPublicDSAKey == nil) {
SULog(@"A public DSA key is found in the old bundle but no public DSA key is found in the new update. For security reasons, the update will be rejected.");
return NO;
}
BOOL dsaKeysMatch = (publicDSAKey == nil || newPublicDSAKey == nil) ? NO : [publicDSAKey isEqualToString:newPublicDSAKey];
// If the new DSA key differs from the old, then this check is not a security measure, because the new key is not trusted.