Skip to content

Commit

Permalink
Force a whitelist for URL schemes
Browse files Browse the repository at this point in the history
  • Loading branch information
emsquared committed Jan 26, 2016
1 parent 4748e87 commit 422a6c8
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
21 changes: 20 additions & 1 deletion Classes/Views/Channel View/TVCLogPolicy.m
Expand Up @@ -201,7 +201,26 @@ - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary
if (action == WebNavigationTypeLinkClicked) {
[listener ignore];

[TLOpenLink open:actionInformation[WebActionOriginalURLKey]];
NSURL *actionURL = actionInformation[WebActionOriginalURLKey];

if (NSObjectsAreEqual([actionURL scheme], @"http") == NO &&
NSObjectsAreEqual([actionURL scheme], @"https") == NO &&
NSObjectsAreEqual([actionURL scheme], @"textual") == NO)
{
BOOL openLink =
[TLOPopupPrompts dialogWindowWithMessage:TXTLS(@"BasicLanguage[1290][2]")
title:TXTLS(@"BasicLanguage[1290][1]", [actionURL absoluteString])
defaultButton:TXTLS(@"BasicLanguage[1290][3]")
alternateButton:TXTLS(@"BasicLanguage[1009]")
suppressionKey:@"open_non_http_url_warning"
suppressionText:nil];

if (openLink == NO) {
return;
}
}

[TLOpenLink open:actionURL];
} else {
[listener use];
}
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/Auto Hyperlinks
7 changes: 6 additions & 1 deletion Resources/Language Files/BasicLanguage.strings
Expand Up @@ -784,9 +784,14 @@
"BasicLanguage[1287][2]" = "Would you like to launch the “Textual Extras” installer to perform update?";
"BasicLanguage[1287][3]" = "Launch Installer";

/* Non-HTTP link warning */
"BasicLanguage[1290][1]" = "Please verify that you would like to open the following URL: %@";
"BasicLanguage[1290][2]" = "The linked you clicked will launch an application other than your web browser which could possibly lead to the leak of your personal information.";
"BasicLanguage[1290][3]" = "I Understand, Continue";



/* Next unusued key: 1290 */

/* Next unusued key: 1291 */


14 changes: 14 additions & 0 deletions Resources/Property Lists/RegisteredUserDefaults.plist
Expand Up @@ -2,6 +2,20 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.adiumX.AutoHyperlinks.permittedSchemes</key>
<array>
<string>feed</string>
<string>ftp</string>
<string>irc</string>
<string>ircs</string>
<string>itms</string>
<string>sftp</string>
<string>ssh</string>
<string>telnet</string>
<string>textual</string>
<string>webcal</string>
<string>x-man-page</string>
</array>
<key>-[NSString isValidInternetAddress] Performs Extended Validation</key>
<true/>
<key>AutojoinMaximumChannelJoinCount</key>
Expand Down

0 comments on commit 422a6c8

Please sign in to comment.