Skip to content

Commit 2103ad5

Browse files
Punycode encode U+0138 in the host of a displayed URL
https://bugs.webkit.org/show_bug.cgi?id=306981 rdar://166796168 Reviewed by Tim Nguyen. It is punycode encoded when displayed in Chrome and Firefox. It doesn't meet our usual requirement for considering a spoofing character because it is visually distinguishable from k, but since other browsers have already done this and since its linguistic use seems to have been replaced by q, let's do the same. Test: Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm * Source/WTF/wtf/URLHelpers.cpp: (WTF::URLHelpers::isLookalikeCharacter): * Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm: (TestWebKitAPI::TEST(URLExtras, URLExtras_Spoof)): Canonical link: https://commits.webkit.org/307005@main
1 parent 2ebfc07 commit 2103ad5

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

Source/WTF/wtf/URLHelpers.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ static bool isLookalikeCharacter(const std::optional<char32_t>& previousCodePoin
220220
case 0x00BD: /* VULGAR FRACTION ONE HALF */
221221
case 0x00BE: /* VULGAR FRACTION THREE QUARTERS */
222222
/* 0x0131 LATIN SMALL LETTER DOTLESS I is intentionally not considered a lookalike character because it is visually distinguishable from i and it has legitimate use in the Turkish language. */
223+
case 0x0138: /* LATIN SMALL LETTER KRA */
223224
case 0x01C0: /* LATIN LETTER DENTAL CLICK */
224225
case 0x01C3: /* LATIN LETTER RETROFLEX CLICK */
225226
case 0x1E9C: /* LATIN SMALL LETTER LONG S WITH DIAGONAL STROKE */

Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@
174174
"xn--ikg"_s, // U+1E9C
175175
"xn--jkg"_s, // U+1E9D
176176
"xn--cng"_s, // U+1EFE or U+1EFF
177+
"xn--jfa"_s, // U+0138
177178
};
178179
for (auto& host : punycodedSpoofHosts) {
179180
auto url = makeString("http://"_s, host, '/').utf8();

0 commit comments

Comments
 (0)