From b64cee8055ad9d29736a53d84bafb10527fdeb0f Mon Sep 17 00:00:00 2001 From: Zorg Date: Tue, 16 Feb 2016 23:03:47 -0500 Subject: [PATCH 1/2] Disable javascript by default and make it opt-in To opt-in to enabling Javascript, set SUEnableJavaScript to true in the app's info.plist --- Sparkle/SUConstants.h | 1 + Sparkle/SUConstants.m | 1 + Sparkle/SUUpdateAlert.m | 1 + 3 files changed, 3 insertions(+) diff --git a/Sparkle/SUConstants.h b/Sparkle/SUConstants.h index b717d843..ae9beae1 100644 --- a/Sparkle/SUConstants.h +++ b/Sparkle/SUConstants.h @@ -50,6 +50,7 @@ extern NSString *const SULastProfileSubmitDateKey; extern NSString *const SUPromptUserOnFirstLaunchKey; extern NSString *const SUKeepDownloadOnFailedInstallKey; extern NSString *const SUDefaultsDomainKey; +extern NSString *const SUEnableJavaScriptKey; extern NSString *const SUFixedHTMLDisplaySizeKey __attribute__((deprecated("This key is obsolete and has no effect."))); extern NSString *const SUAppendVersionNumberKey __attribute__((deprecated("This key is obsolete. See SPARKLE_APPEND_VERSION_NUMBER."))); extern NSString *const SUEnableAutomatedDowngradesKey __attribute__((deprecated("This key is obsolete. See SPARKLE_AUTOMATED_DOWNGRADES."))); diff --git a/Sparkle/SUConstants.m b/Sparkle/SUConstants.m index 31c80ca3..dbaefe13 100644 --- a/Sparkle/SUConstants.m +++ b/Sparkle/SUConstants.m @@ -42,6 +42,7 @@ NSString *const SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup"; NSString *const SUSendProfileInfoKey = @"SUSendProfileInfo"; NSString *const SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate"; NSString *const SUPromptUserOnFirstLaunchKey = @"SUPromptUserOnFirstLaunch"; +NSString *const SUEnableJavaScriptKey = @"SUEnableJavaScript"; NSString *const SUFixedHTMLDisplaySizeKey = @"SUFixedHTMLDisplaySize"; NSString *const SUKeepDownloadOnFailedInstallKey = @"SUKeepDownloadOnFailedInstall"; NSString *const SUDefaultsDomainKey = @"SUDefaultsDomain"; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 3433299d..d7b6702a 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -122,6 +122,7 @@ self.releaseNotesView.preferencesIdentifier = SUBundleIdentifier; WebPreferences *prefs = [self.releaseNotesView preferences]; prefs.plugInsEnabled = NO; + prefs.javaScriptEnabled = [self.host boolForInfoDictionaryKey:SUEnableJavaScriptKey]; self.releaseNotesView.frameLoadDelegate = self; self.releaseNotesView.policyDelegate = self; From 4eb2e9af0023e6fc0cbc657a8490441a7310670a Mon Sep 17 00:00:00 2001 From: Zorg Date: Tue, 16 Feb 2016 23:07:26 -0500 Subject: [PATCH 2/2] Disable Java in the web view too Plug-ins have already been disabled but I'm not sure if that encompasses Java or not. May as well be explicit in either case and disable it. --- Sparkle/SUUpdateAlert.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index d7b6702a..08ccc755 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -122,6 +122,7 @@ self.releaseNotesView.preferencesIdentifier = SUBundleIdentifier; WebPreferences *prefs = [self.releaseNotesView preferences]; prefs.plugInsEnabled = NO; + prefs.javaEnabled = NO; prefs.javaScriptEnabled = [self.host boolForInfoDictionaryKey:SUEnableJavaScriptKey]; self.releaseNotesView.frameLoadDelegate = self; self.releaseNotesView.policyDelegate = self;