Compare commits

...
8 changed files with 91 additions and 32 deletions

No files matched your search

+3 -3
View File
@@ -71,7 +71,7 @@ jobs:
run: |
git config user.name Sparkle-Bot
git config user.email sparkle.project.bot@gmail.com
git tag "${{ github.event.inputs.marketingVersion }}"
git tag "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
- name: "Build release distribution"
run: make release
@@ -90,8 +90,8 @@ jobs:
with:
draft: true
prerelease: ${{ env.PRERELEASE_VERSION }}
name: "Sparkle ${{ github.event.inputs.marketingVersion }}"
tag_name: ${{ github.event.inputs.marketingVersion }}
name: "Sparkle ${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
tag_name: "${{ github.event.inputs.marketingVersion }}${{ github.event.inputs.prereleaseSuffix }}"
fail_on_unmatched_files: true
token: ${{ secrets.BOT_PERSONAL_ACCESS_TOKEN }}
body_path: latest-changes.txt
+3
View File
@@ -4,6 +4,9 @@
* Fix to prevent Sparkle manipulating the host app's high level WebView defaults from #1961 (affecting only macOS versions before 10.11 in 1.x branch) (Daniel Jalkut)
* Add safer handling of applying binary delta files from #1990 (Zorg)
* Don't use current date unless necessary when scheduling next update to be more resilient against rapid polling from #1991 (Zorg)
* Prevent potential rapid update checks from sleep/wake events using a minimum monotonic delay from #2000 (Zorg)
* Whitelist about:srcdoc as a safe web URL from #1938, #2007 (Louis Pontoise, Zorg)
* Backport not hiding update window on deactivation from #2008 (Zorg)
# 1.27.0
+2 -2
View File
@@ -23,9 +23,9 @@ SPARKLE_VERSION_PATCH = 1
// This should be in SemVer format or empty, ie. "-rc.1"
// These variables must have a space after the '=' too
SPARKLE_VERSION_SUFFIX = -rc.1
SPARKLE_VERSION_SUFFIX = -rc.2
// This is now a monotonically increasing ID number, even across prereleases, but let's keep this below 2.0
CURRENT_PROJECT_VERSION = 1.103
CURRENT_PROJECT_VERSION = 1.105
MARKETING_VERSION = $(SPARKLE_VERSION_MAJOR).$(SPARKLE_VERSION_MINOR).$(SPARKLE_VERSION_PATCH)$(SPARKLE_VERSION_SUFFIX)
+3 -3
View File
@@ -2,10 +2,10 @@
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "1.27.1-rc.1"
let version = "1.27.1-rc.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 = "1.27.1-rc.1"
let checksum = "29ea21aff129265413ca48785eacd4823cea89670299675069d36c41fd0a33e9"
let tag = "1.27.1-rc.2"
let checksum = "bad8b1adf12f0d1ab7ad093ca74727d6fafc2a3b2066e67e92bec3938ef0e0c1"
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 = "1.27.1-rc.1"
s.version = "1.27.1-rc.2"
s.summary = "A software update framework for macOS"
s.description = "Sparkle is an easy-to-use software update framework for Cocoa developers."
s.homepage = "https://sparkle-project.org"
+1
View File
@@ -18,6 +18,7 @@
extern const NSTimeInterval SUMinimumUpdateCheckInterval;
extern const NSTimeInterval SUDefaultUpdateCheckInterval;
extern const NSTimeInterval SUMinimumMonotonicUpdateCheckInterval;
extern NSString *const SUBundleIdentifier;
+1
View File
@@ -18,6 +18,7 @@
// Define some minimum intervals to avoid DoS-like checking attacks
const NSTimeInterval SUMinimumUpdateCheckInterval = DEBUG ? 60 : (60 * 60);
const NSTimeInterval SUDefaultUpdateCheckInterval = DEBUG ? 60 : (60 * 60 * 24);
const NSTimeInterval SUMinimumMonotonicUpdateCheckInterval = DEBUG ? 30 : (60 * 5);
NSString *const SUBundleIdentifier = @SPARKLE_BUNDLE_IDENTIFIER;
+77 -23
View File
@@ -41,11 +41,12 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@property (assign) BOOL shouldRescheduleOnWake;
@property (strong) NSBundle *sparkleBundle;
@property (nonatomic) BOOL loggedNoSecureKeyWarning;
@property (nonatomic) NSTimeInterval lastMonotonicUpdateCheckTime;
- (instancetype)initForBundle:(NSBundle *)bundle;
- (void)startUpdateCycle;
- (void)checkForUpdatesWithDriver:(SUUpdateDriver *)updateDriver;
- (void)scheduleNextUpdateCheckUsingCurrentTime:(BOOL)usingCurrentTime;
- (void)scheduleNextUpdateCheckUsingCurrentDate:(BOOL)usingCurrentDate;
- (void)registerAsObserver;
- (void)unregisterAsObserver;
- (void)updateDriverDidFinish:(NSNotification *)note;
@@ -71,6 +72,7 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification
@synthesize decryptionPassword;
@synthesize updateLastCheckedDate;
@synthesize loggedNoSecureKeyWarning = _loggedNoSecureKeyWarning;
@synthesize lastMonotonicUpdateCheckTime = _lastMonotonicUpdateCheckTime;
static NSMutableDictionary *sharedUpdaters = nil;
static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObservationContext";
@@ -255,7 +257,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// We start the update checks and register as observer for changes after the prompt finishes
} else {
// We check if the user's said they want updates, or they haven't said anything, and the default is set to checking.
[self scheduleNextUpdateCheckUsingCurrentTime:YES];
[self scheduleNextUpdateCheckUsingCurrentDate:YES];
}
}
@@ -271,7 +273,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
{
self.driver = nil;
[self updateLastUpdateCheckDate];
[self scheduleNextUpdateCheckUsingCurrentTime:NO];
[self scheduleNextUpdateCheckUsingCurrentDate:NO];
}
}
@@ -285,15 +287,25 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
return [self updateLastCheckedDate];
}
- (NSTimeInterval)currentMonotonicTimeInterval
{
// This is monotonic system time while the system is not asleep
return [[NSProcessInfo processInfo] systemUptime];
}
- (void)updateLastUpdateCheckDate
{
[self willChangeValueForKey:@"lastUpdateCheckDate"];
[self setUpdateLastCheckedDate:[NSDate date]];
[self.host setObject:[self updateLastCheckedDate] forUserDefaultsKey:SULastCheckTimeKey];
self.lastMonotonicUpdateCheckTime = [self currentMonotonicTimeInterval];
[self didChangeValueForKey:@"lastUpdateCheckDate"];
}
- (void)scheduleNextUpdateCheckUsingCurrentTime:(BOOL)usingCurrentTime
- (void)scheduleNextUpdateCheckUsingCurrentDate:(BOOL)usingCurrentDate
{
if (self.checkTimer)
{
@@ -303,30 +315,70 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
if (![self automaticallyChecksForUpdates]) return;
// How long has it been since last we checked for an update?
NSTimeInterval intervalSinceCheck;
if (usingCurrentTime) {
NSTimeInterval dateIntervalSinceCheck;
NSTimeInterval minimumEnforcedDelay;
if (usingCurrentDate) {
NSDate *lastCheckDate = [self lastUpdateCheckDate];
if (!lastCheckDate) { lastCheckDate = [NSDate distantPast]; }
intervalSinceCheck = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
if (intervalSinceCheck < 0) {
NSTimeInterval wallTimeInterval = [[NSDate date] timeIntervalSinceDate:lastCheckDate];
if (wallTimeInterval < 0) {
// Last update check date is in the future and bogus, so reset it to current date
[self updateLastUpdateCheckDate];
intervalSinceCheck = 0;
// And assume a full update interval is needed
dateIntervalSinceCheck = 0;
minimumEnforcedDelay = SUMinimumMonotonicUpdateCheckInterval;
} else {
// Check the monotonic clock for an enforced minimum delay
NSTimeInterval lastMonotonicUpdateCheckTime = self.lastMonotonicUpdateCheckTime;
if (lastMonotonicUpdateCheckTime <= 0) {
// When the updater is first started, the last monotonic time may not have been updated yet.
// In this case there is no enforced minimum delay.
minimumEnforcedDelay = 0;
} else {
// Compute an enforced minimum delay based on elapsed monotonic time
// The elapsed monotonic time is more stable than wall time interval and does not include the
// amount of time while the system is asleep
NSTimeInterval currentMonotonicTime = [self currentMonotonicTimeInterval];
NSTimeInterval elapsedMonotonicTime = (currentMonotonicTime - lastMonotonicUpdateCheckTime);
if (elapsedMonotonicTime < SUMinimumMonotonicUpdateCheckInterval) {
minimumEnforcedDelay = (SUMinimumMonotonicUpdateCheckInterval - elapsedMonotonicTime);
} else {
minimumEnforcedDelay = 0;
}
}
dateIntervalSinceCheck = wallTimeInterval;
}
} else {
intervalSinceCheck = 0;
// Without using the current date, we assume a full update interval is needed
dateIntervalSinceCheck = 0;
minimumEnforcedDelay = SUMinimumMonotonicUpdateCheckInterval;
}
// Now we want to figure out how long until we check again.
NSTimeInterval delayUntilCheck, updateCheckInterval = [self updateCheckInterval];
if (updateCheckInterval < SUMinimumUpdateCheckInterval)
NSTimeInterval updateCheckInterval = [self updateCheckInterval];
if (updateCheckInterval < SUMinimumUpdateCheckInterval) {
updateCheckInterval = SUMinimumUpdateCheckInterval;
if (intervalSinceCheck < updateCheckInterval)
delayUntilCheck = (updateCheckInterval - intervalSinceCheck); // It hasn't been long enough.
else
delayUntilCheck = 0; // We're overdue! Run one now.
self.checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheck target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO]; // Timer is non-repeating, may have invalidated itself, so we had to retain it.
}
// Now we want to figure out how long until we check again.
NSTimeInterval delayUntilCheck;
if (dateIntervalSinceCheck < updateCheckInterval) {
// It hasn't been long enough.
delayUntilCheck = (updateCheckInterval - dateIntervalSinceCheck);
} else {
// We're overdue!
delayUntilCheck = 0;
}
// Now compute delay with enforced minimum delay requirement
// The minimum delay (based on monotonic clock) is an extra layer of defense to prevent too frequent update checks
// in case the wall clock is not working properly (eg from too many system wake events, system date changes, NTP..)
NSTimeInterval delayUntilCheckWithMinimumEnforcedDelay =
(delayUntilCheck < minimumEnforcedDelay) ? minimumEnforcedDelay : delayUntilCheck;
self.checkTimer = [NSTimer scheduledTimerWithTimeInterval:delayUntilCheckWithMinimumEnforcedDelay target:self selector:@selector(checkForUpdatesInBackground) userInfo:nil repeats:NO];
}
- (void)receiveSleepNote
@@ -343,8 +395,10 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
- (void)receiveWakeNote
{
if (self.shouldRescheduleOnWake) // the reason for rescheduling the update-check timer is that NSTimer does behave as if the time the Mac spends asleep did not exist at all, which can significantly prolong the time between update checks
[self scheduleNextUpdateCheckUsingCurrentTime:YES];
// the reason for rescheduling the update-check timer is that NSTimer does behave as if the time the Mac spends asleep did not exist at all, which can significantly prolong the time between update checks
if (self.shouldRescheduleOnWake) {
[self scheduleNextUpdateCheckUsingCurrentDate:YES];
}
}
- (void)checkForUpdatesInBackground
@@ -397,7 +451,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
if( [self.delegate respondsToSelector: @selector(updaterMayCheckForUpdates:)] && ![self.delegate updaterMayCheckForUpdates: self] )
{
[self scheduleNextUpdateCheckUsingCurrentTime:NO];
[self scheduleNextUpdateCheckUsingCurrentDate:NO];
return;
}
@@ -406,7 +460,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
// If we're not given a driver at all, just schedule the next update check and bail.
if (!self.driver)
{
[self scheduleNextUpdateCheckUsingCurrentTime:NO];
[self scheduleNextUpdateCheckUsingCurrentDate:NO];
return;
}
@@ -458,7 +512,7 @@ static NSString *const SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaults
- (void)resetUpdateCycle
{
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(resetUpdateCycle) object:nil];
[self scheduleNextUpdateCheckUsingCurrentTime:YES];
[self scheduleNextUpdateCheckUsingCurrentDate:YES];
}
- (void)setAutomaticallyChecksForUpdates:(BOOL)automaticallyCheckForUpdates