Skip to content

Commit 422a6c8

Browse files
committed
Force a whitelist for URL schemes
1 parent 4748e87 commit 422a6c8

File tree

4 files changed

+41
-3
lines changed

4 files changed

+41
-3
lines changed

Classes/Views/Channel View/TVCLogPolicy.m

+20-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,26 @@ - (void)webView:(WebView *)webView decidePolicyForNavigationAction:(NSDictionary
201201
if (action == WebNavigationTypeLinkClicked) {
202202
[listener ignore];
203203

204-
[TLOpenLink open:actionInformation[WebActionOriginalURLKey]];
204+
NSURL *actionURL = actionInformation[WebActionOriginalURLKey];
205+
206+
if (NSObjectsAreEqual([actionURL scheme], @"http") == NO &&
207+
NSObjectsAreEqual([actionURL scheme], @"https") == NO &&
208+
NSObjectsAreEqual([actionURL scheme], @"textual") == NO)
209+
{
210+
BOOL openLink =
211+
[TLOPopupPrompts dialogWindowWithMessage:TXTLS(@"BasicLanguage[1290][2]")
212+
title:TXTLS(@"BasicLanguage[1290][1]", [actionURL absoluteString])
213+
defaultButton:TXTLS(@"BasicLanguage[1290][3]")
214+
alternateButton:TXTLS(@"BasicLanguage[1009]")
215+
suppressionKey:@"open_non_http_url_warning"
216+
suppressionText:nil];
217+
218+
if (openLink == NO) {
219+
return;
220+
}
221+
}
222+
223+
[TLOpenLink open:actionURL];
205224
} else {
206225
[listener use];
207226
}

Resources/Language Files/BasicLanguage.strings

+6-1
Original file line numberDiff line numberDiff line change
@@ -784,9 +784,14 @@
784784
"BasicLanguage[1287][2]" = "Would you like to launch the “Textual Extras” installer to perform update?";
785785
"BasicLanguage[1287][3]" = "Launch Installer";
786786

787+
/* Non-HTTP link warning */
788+
"BasicLanguage[1290][1]" = "Please verify that you would like to open the following URL: %@";
789+
"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.";
790+
"BasicLanguage[1290][3]" = "I Understand, Continue";
787791

788792

789793

790-
/* Next unusued key: 1290 */
794+
795+
/* Next unusued key: 1291 */
791796

792797

Resources/Property Lists/RegisteredUserDefaults.plist

+14
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,20 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>com.adiumX.AutoHyperlinks.permittedSchemes</key>
6+
<array>
7+
<string>feed</string>
8+
<string>ftp</string>
9+
<string>irc</string>
10+
<string>ircs</string>
11+
<string>itms</string>
12+
<string>sftp</string>
13+
<string>ssh</string>
14+
<string>telnet</string>
15+
<string>textual</string>
16+
<string>webcal</string>
17+
<string>x-man-page</string>
18+
</array>
519
<key>-[NSString isValidInternetAddress] Performs Extended Validation</key>
620
<true/>
721
<key>AutojoinMaximumChannelJoinCount</key>

0 commit comments

Comments
 (0)