From afc4179c0d151b306bf1644c8a2a349ec6b981df Mon Sep 17 00:00:00 2001 From: Daniel Jalkut Date: Mon, 28 Apr 2025 20:40:08 -0400 Subject: [PATCH 1/2] Rework the logic for avoiding re-sending the system profile more frequently than once a week (#2720) So that it will not use a potentially problematic binary compare operation. Fixes #278. --- Sparkle/SPUUpdater.m | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index c549734e..88cf580c 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -1094,12 +1094,17 @@ static NSString *escapeURLComponent(NSString *str) { BOOL sendingSystemProfile = [self sendsSystemProfile]; // Let's only send the system profiling information once per week at most, so we normalize daily-checkers vs. biweekly-checkers and the such. - NSDate *lastSubmitDate = [_host objectForUserDefaultsKey:SULastProfileSubmitDateKey]; - if (!lastSubmitDate) { - lastSubmitDate = [NSDate distantPast]; + if (sendingSystemProfile) { + NSDate *lastSubmitDate = [_host objectForUserDefaultsKey:SULastProfileSubmitDateKey]; + if (!lastSubmitDate) { + lastSubmitDate = [NSDate distantPast]; + } + const NSTimeInterval oneWeek = 60 * 60 * 24 * 7; + NSTimeInterval timeSinceLastSubmission = [lastSubmitDate timeIntervalSinceNow] * -1; + if (timeSinceLastSubmission < oneWeek) { + sendingSystemProfile = NO; + } } - const NSTimeInterval oneWeek = 60 * 60 * 24 * 7; - sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek); id delegate = _delegate; NSArray *> *parameters = @[]; From fea50c33c8d37c4f41414213fbf7f92ff8ff24d8 Mon Sep 17 00:00:00 2001 From: Zorg Date: Wed, 30 Apr 2025 21:30:59 -0400 Subject: [PATCH 2/2] Add private module map (#2722) Require importing explicit submodules for private functionality. --- Configurations/ConfigFramework.xcconfig | 3 ++ Sparkle.xcodeproj/project.pbxproj | 2 ++ Sparkle/Sparkle.private.modulemap | 38 +++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 Sparkle/Sparkle.private.modulemap diff --git a/Configurations/ConfigFramework.xcconfig b/Configurations/ConfigFramework.xcconfig index e557f067..32b4478a 100644 --- a/Configurations/ConfigFramework.xcconfig +++ b/Configurations/ConfigFramework.xcconfig @@ -24,3 +24,6 @@ STRINGS_FILE_OUTPUT_ENCODING = binary // with Application Extensions, then we should allow frameworks that require // compatibility to be able to link with us. APPLICATION_EXTENSION_API_ONLY = YES + +ENABLE_MODULE_VERIFIER = YES +MODULEMAP_PRIVATE_FILE = Sparkle/Sparkle.private.modulemap diff --git a/Sparkle.xcodeproj/project.pbxproj b/Sparkle.xcodeproj/project.pbxproj index 87d7e335..40687805 100644 --- a/Sparkle.xcodeproj/project.pbxproj +++ b/Sparkle.xcodeproj/project.pbxproj @@ -1093,6 +1093,7 @@ 72316BD11E0DA8430039EFD9 /* SUUnarchiverNotifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SUUnarchiverNotifier.h; path = Autoupdate/SUUnarchiverNotifier.h; sourceTree = SOURCE_ROOT; }; 72316BD21E0DA8430039EFD9 /* SUUnarchiverNotifier.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SUUnarchiverNotifier.m; path = Autoupdate/SUUnarchiverNotifier.m; sourceTree = SOURCE_ROOT; }; 7235B75E29DFC0120081FE4E /* make-xcframework.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "make-xcframework.sh"; sourceTree = ""; }; + 72366CCC2DC2D1FC003CE62B /* Sparkle.private.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = Sparkle.private.modulemap; sourceTree = ""; }; 723ABCD7259A9A9D00BDB4FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Sparkle.strings; sourceTree = ""; }; 723ABD37259A9BA500BDB4FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SUUpdateAlert.xib; sourceTree = ""; }; 723ABD4C259A9BB900BDB4FA /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/SUUpdateAlert.strings; sourceTree = ""; }; @@ -1845,6 +1846,7 @@ isa = PBXGroup; children = ( 720767D11E2EB86200F9A850 /* AppKitPrevention.h */, + 72366CCC2DC2D1FC003CE62B /* Sparkle.private.modulemap */, 61299B3909CB055000B7442F /* Appcast Support */, 55C14BD5136EEFD000649790 /* Autoupdate */, 72F9EBE41D519425004AC8B6 /* Deprecated */, diff --git a/Sparkle/Sparkle.private.modulemap b/Sparkle/Sparkle.private.modulemap new file mode 100644 index 00000000..8bc5cfd1 --- /dev/null +++ b/Sparkle/Sparkle.private.modulemap @@ -0,0 +1,38 @@ +// +// Sparkle.private.modulemap +// Sparkle +// +// Created on 4/30/25. +// Copyright © 2025 Sparkle Project. All rights reserved. +// + +framework module Sparkle_Private { + // Nothing exported here +} + +explicit module Sparkle_Private.SPUStandardUserDriver { + header "SPUStandardUserDriver+Private.h" + export * +} + +explicit module Sparkle_Private.SPUGentleUserDriverReminders { + header "SPUGentleUserDriverReminders.h" + export * +} + +explicit module Sparkle_Private.SPUUserAgent { + header "SPUUserAgent+Private.h" + export * +} + +explicit module Sparkle_Private.SUAppcastItem { + header "SUAppcastItem+Private.h" + header "SPUAppcastItemStateResolver.h" + export * +} + +explicit module Sparkle_Private.SUInstallerLauncher { + header "SUInstallerLauncher+Private.h" + header "SPUInstallationType.h" + export * +}