diff --git a/Sparkle/SUAppcast.m b/Sparkle/SUAppcast.m index dced1da7..42254148 100644 --- a/Sparkle/SUAppcast.m +++ b/Sparkle/SUAppcast.m @@ -102,7 +102,7 @@ if (self.downloadFilename) { NSUInteger options = 0; - options = NSXMLNodeLoadExternalEntitiesSameOriginOnly; + options = NSXMLNodeLoadExternalEntitiesNever; // Prevent inclusion from file:// document = [[NSXMLDocument alloc] initWithContentsOfURL:[NSURL fileURLWithPath:self.downloadFilename] options:options error:&error]; [[NSFileManager defaultManager] removeItemAtPath:self.downloadFilename error:nil]; diff --git a/Sparkle/SUUpdateAlert.m b/Sparkle/SUUpdateAlert.m index 42565b00..fc321685 100644 --- a/Sparkle/SUUpdateAlert.m +++ b/Sparkle/SUUpdateAlert.m @@ -262,8 +262,17 @@ - (void)webView:(WebView *)__unused sender decidePolicyForNavigationAction:(NSDictionary *)__unused actionInformation request:(NSURLRequest *)request frame:(WebFrame *)__unused frame decisionListener:(id)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 (self.webViewFinishedLoading) { - NSURL *requestURL = request.URL; if (requestURL) { [[NSWorkspace sharedWorkspace] openURL:requestURL]; }