From ec7f55d173f414d8c27b3b2aac10a7036a99a35a Mon Sep 17 00:00:00 2001 From: Kornel Date: Wed, 27 Sep 2017 18:45:36 +0200 Subject: [PATCH 01/44] Handle SecTransformExecute errors Fixes #1129 --- generate_appcast/DSASignature.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/generate_appcast/DSASignature.swift b/generate_appcast/DSASignature.swift index c1c61d18..eccd1e18 100644 --- a/generate_appcast/DSASignature.swift +++ b/generate_appcast/DSASignature.swift @@ -49,6 +49,12 @@ func dsaSignature(path: URL, privateKey: SecKey) throws -> String { throw error!.takeRetainedValue(); } - let result = SecTransformExecute(group, &error) as! Data; - return result.base64EncodedString(); + let result = SecTransformExecute(group, &error); + if (error != nil) { + throw error!.takeRetainedValue(); + } + guard let resultData = result as? Data else { + throw makeError(code: .signatureError, "SecTransformExecute returned non-data"); + } + return resultData.base64EncodedString(); } From a2ecdd2744724aabf0c5caf866a84e24b6c02496 Mon Sep 17 00:00:00 2001 From: Jonathan Bullard Date: Thu, 5 Oct 2017 08:57:04 -0400 Subject: [PATCH 02/44] Fix #1061 & #835: Sparkle clients polling too frequently MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SULastCheckTimeKey preference (a/k/a "default"), which is stored in ~/Library/Preferences/….plist, was used to store the date of the last update check. That causes a problem if the storage is read-only (for example, if the .plist file is “locked” (has the uchg or schg flag set) or if the SULastCheckTimeKey key "exists in a domain that precedes the application domain the search list"). The date would never be modified, and the old date would cause a new update check to be queued at the end of an update check. If application or bundle was up-to-date, or the user had chosen to skip the update that was available, this would cause update checks to happen as often as the computer and network would allow, many times each second. The new code uses an instance variable to store the value. The variable is initially loaded from the “SULastCheckTimeKey” preference, and each time the variable is modified its new value is stored to that preference. However, the variable, not the preference, is used when calculating whether enough time has passed since the last update check to warrant another check. The variable will always (after the first update check) have the "correct" value, and update checks will not be done more frequently than desired. --- Sparkle/SUUpdater.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index b20d9499..3c8d9c32 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -49,6 +49,8 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @property (strong) SUUpdateDriver *driver; @property (strong) SUHost *host; +@property (copy) NSDate *updateLastCheckedDate; + @end @implementation SUUpdater @@ -61,6 +63,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification @synthesize host; @synthesize sparkleBundle; @synthesize decryptionPassword; +@synthesize updateLastCheckedDate; static NSMutableDictionary *sharedUpdaters = nil; static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext"; @@ -253,13 +256,20 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults - (NSDate *)lastUpdateCheckDate { - return [self.host objectForUserDefaultsKey:SULastCheckTimeKey]; + if (![self updateLastCheckedDate]) + { + [self setUpdateLastCheckedDate:[self.host objectForUserDefaultsKey:SULastCheckTimeKey]]; + } + + return [self updateLastCheckedDate]; } - (void)updateLastUpdateCheckDate { + [self setUpdateLastCheckedDate:[NSDate date]]; + [self willChangeValueForKey:@"lastUpdateCheckDate"]; - [self.host setObject:[NSDate date] forUserDefaultsKey:SULastCheckTimeKey]; + [self.host setObject:[self updateLastCheckedDate] forUserDefaultsKey:SULastCheckTimeKey]; [self didChangeValueForKey:@"lastUpdateCheckDate"]; } From 10f831fce870a98e630f517a488918333279e4d9 Mon Sep 17 00:00:00 2001 From: Jonathan Bullard Date: Thu, 5 Oct 2017 09:36:31 -0400 Subject: [PATCH 03/44] Move [NSDate date] to be after willChangeValueForKey Per comment by Pornel --- Sparkle/SUUpdater.m | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sparkle/SUUpdater.m b/Sparkle/SUUpdater.m index 3c8d9c32..0cab3d6d 100644 --- a/Sparkle/SUUpdater.m +++ b/Sparkle/SUUpdater.m @@ -266,9 +266,8 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults - (void)updateLastUpdateCheckDate { - [self setUpdateLastCheckedDate:[NSDate date]]; - [self willChangeValueForKey:@"lastUpdateCheckDate"]; + [self setUpdateLastCheckedDate:[NSDate date]]; [self.host setObject:[self updateLastCheckedDate] forUserDefaultsKey:SULastCheckTimeKey]; [self didChangeValueForKey:@"lastUpdateCheckDate"]; } From 0cb0b2f2c7b07b65231528991ac98dc384e51146 Mon Sep 17 00:00:00 2001 From: Kornel Date: Tue, 10 Oct 2017 12:25:40 +0100 Subject: [PATCH 04/44] Update for newer OpenSSL --- bin/sign_update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sign_update b/bin/sign_update index 7c439990..8fadc4e1 100755 --- a/bin/sign_update +++ b/bin/sign_update @@ -6,4 +6,4 @@ if [ "$#" -ne 2 ]; then exit 1 fi openssl=/usr/bin/openssl -$openssl dgst -sha1 -binary < "$1" | $openssl dgst -dss1 -sign "$2" | $openssl enc -base64 +$openssl dgst -sha1 -binary < "$1" | $openssl dgst -sha1 -sign "$2" | $openssl enc -base64 From 68f62e5955b360a366b3d405463b29b0aef06763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Paych=C3=A8re?= Date: Sat, 21 Oct 2017 20:29:51 +0200 Subject: [PATCH 05/44] Update Sparkle.strings Translation of "Description text for SUUpdateAlert when the update informational with no download." --- Sparkle/fr.lproj/Sparkle.strings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sparkle/fr.lproj/Sparkle.strings b/Sparkle/fr.lproj/Sparkle.strings index 5262ae13..ad4466a1 100644 --- a/Sparkle/fr.lproj/Sparkle.strings +++ b/Sparkle/fr.lproj/Sparkle.strings @@ -8,7 +8,7 @@ "%@ %@ is now available--you have %@. Would you like to download it now?" = "%1$@ %2$@ est disponible ; vous utilisez la version %3$@. Voulez-vous le télécharger maintenant ?"; /* Description text for SUUpdateAlert when the update informational with no download. */ -"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ is now available--you have %3$@. Would you like to learn more about this update on the web?"; +"%@ %@ is now available--you have %@. Would you like to learn more about this update on the web?" = "%1$@ %2$@ est disponible ; vous utilisez la version %3$@. Voulez-vous en savoir plus sur cette mise à jour sur Internet ?"; "%@ downloaded" = "%@ téléchargé"; From 2477a92b0f02ec3420315cb188cf1a431c74bc2f Mon Sep 17 00:00:00 2001 From: 1024jp <1024jp@wolfrosch.com> Date: Sat, 25 Nov 2017 15:33:34 +0900 Subject: [PATCH 06/44] Update Japanese localization --- Sparkle/ja.lproj/SUUpdateAlert.xib | 37 ++++++++++--------- Sparkle/ja.lproj/SUUpdatePermissionPrompt.xib | 19 +++++----- Sparkle/ja.lproj/Sparkle.strings | 34 ++++++++--------- 3 files changed, 46 insertions(+), 44 deletions(-) diff --git a/Sparkle/ja.lproj/SUUpdateAlert.xib b/Sparkle/ja.lproj/SUUpdateAlert.xib index 4829fb4c..01c39e50 100644 --- a/Sparkle/ja.lproj/SUUpdateAlert.xib +++ b/Sparkle/ja.lproj/SUUpdateAlert.xib @@ -1,12 +1,13 @@ - + - - - + + + + @@ -27,7 +28,7 @@ - + @@ -47,7 +48,7 @@ - + @@ -61,7 +62,7 @@ - + @@ -76,16 +77,16 @@ - + - + - + - + @@ -116,12 +117,12 @@ - + - - + + @@ -144,7 +145,7 @@