Commit f03cb672 authored by Kornel Lesiński's avatar Kornel Lesiński Committed by Felix Paul Kühne

contrib/sparkle: secure updates

Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent fd04c8bc
......@@ -16,6 +16,8 @@ sparkle: Sparkle-$(SPARKLE_VERSION).zip .sum-sparkle
$(UNPACK)
$(APPLY) $(SRC)/sparkle/sparkle-fix-compilation-on-snowleopard.patch
$(APPLY) $(SRC)/sparkle/sparkle-fix-runtime-exception-on-snowleopard.patch
$(APPLY) $(SRC)/sparkle/sparkle-disable-redirects-to-non-HTTP-URLs-in-release-notes.patch
$(APPLY) $(SRC)/sparkle/sparkle-prevent-inclusion-of-local-files-via-file-XML-entiti.patch
$(MOVE)
.sparkle: sparkle
......
diff -ru Sparkle-1.6.1/SUUpdateAlert.m Sparkle-1.6.1-fixed/SUUpdateAlert.m
--- Sparkle-1.6.1/SUUpdateAlert.m 2014-04-26 00:22:59.000000000 +0200
+++ Sparkle-1.6.1-fixed/SUUpdateAlert.m 2016-01-20 11:38:47.000000000 +0100
@@ -313,6 +313,16 @@
- (void)webView:sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:frame decisionListener:listener
{
+ NSURL *requestURL = request.URL;
+ NSString *scheme = requestURL.scheme;
+ BOOL whitelistedSafe = [@"http" isEqualToString:scheme] || [@"https" isEqualToString:scheme] || [@"about:blank" isEqualToString:requestURL.absoluteString];
+
+ // Do not allow redirects to dangerous protocols such as file://
+ if (!whitelistedSafe) {
+ [listener ignore];
+ return;
+ }
+
if (webViewFinishedLoading) {
[[NSWorkspace sharedWorkspace] openURL:[request URL]];
diff -ru Sparkle-1.6.1/SUAppcast.m Sparkle-1.6.1-fixed/SUAppcast.m
--- Sparkle-1.6.1/SUAppcast.m 2016-01-20 11:39:11.000000000 +0100
+++ Sparkle-1.6.1-fixed/SUAppcast.m 2016-01-20 11:40:53.000000000 +0100
@@ -92,7 +92,7 @@
if (downloadFilename)
{
- NSUInteger options = NSXMLDocumentTidyXML;
+ NSUInteger options = NSXMLDocumentTidyXML | NSXMLNodeLoadExternalEntitiesNever;
document = [[[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:downloadFilename] options:options error:&error] autorelease];
[[NSFileManager defaultManager] removeItemAtPath:downloadFilename error:nil];
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment