Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: components/url_formatter/url_formatter_unittest.cc

Issue 2784933002: Mitigate spoofing attempt using Latin letters. (Closed)
Patch Set: Delete two more accidentally added files Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/url_formatter/url_formatter.h" 5 #include "components/url_formatter/url_formatter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 L"\x0455\x0441\x043e\x0440\x0435\u00b7\x0440\x0430\x0443.\x0440\x0444", 274 L"\x0455\x0441\x043e\x0440\x0435\u00b7\x0440\x0430\x0443.\x0440\x0444",
275 true}, 275 true},
276 276
277 // ѕсоре-рау.한국 with ѕсоре and рау in Cyrillic. 277 // ѕсоре-рау.한국 with ѕсоре and рау in Cyrillic.
278 {"xn----8sbn9akccw8m.xn--3e0b707e", 278 {"xn----8sbn9akccw8m.xn--3e0b707e",
279 L"\x0455\x0441\x043e\x0440\x0435-\x0440\x0430\x0443.\xd55c\xad6d", true}, 279 L"\x0455\x0441\x043e\x0440\x0435-\x0440\x0430\x0443.\xd55c\xad6d", true},
280 280
281 // музей (museum in Russian) has characters without a Latin-look-alike. 281 // музей (museum in Russian) has characters without a Latin-look-alike.
282 {"xn--e1adhj9a.com", L"\x043c\x0443\x0437\x0435\x0439.com", true}, 282 {"xn--e1adhj9a.com", L"\x043c\x0443\x0437\x0435\x0439.com", true},
283 283
284 // Combining Diacritic marks after a script other than Latin-Greek-Cyrillic
285 {"xn--rsa2568fvxya.com", L"\xd55c\x0301\xae00.com", false}, // 한́글.com
286 {"xn--rsa0336bjom.com", L"\x6f22\x0307\x5b57.com", false}, // 漢̇字.com
287 // नागरी́.com
288 {"xn--lsa922apb7a6do.com", L"\x0928\x093e\x0917\x0930\x0940\x0301.com",
289 false},
290
291 // Similarity checks against the list of top domains. "digklmo68.com" and
292 // 'digklmo68.co.uk" are listed for unittest in the top domain list.
293 {"xn--igklmo68-nea32c.com", L"\x0111igklmo68.com", false}, // đigklmo68.com
294 {"www.xn--igklmo68-nea32c.com", L"www.\x0111igklmo68.com", false},
295 {"foo.bar.xn--igklmo68-nea32c.com", L"foo.bar.\x0111igklmo68.com", false},
296 {"xn--igklmo68-nea32c.co.uk", L"\x0111igklmo68.co.uk", false},
297 {"mail.xn--igklmo68-nea32c.co.uk", L"mail.\x0111igklmo68.co.uk", false},
298 {"xn--digklmo68-6jf.com", L"di\x0307gklmo68.com", false}, // di̇gklmo68.com
299 {"xn--digklmo68-7vf.com", L"dig\x0331klmo68.com", false}, // dig̱klmo68.com
300 {"xn--diglmo68-omb.com", L"dig\x0138lmo68.com", false}, // digĸlmo68.com
301 {"xn--digkmo68-9ob.com", L"digk\x0142mo68.com", false}, // digkłmo68.com
302 {"xn--digklo68-l89c.com", L"digkl\x1e43o68.com", false}, // digklṃo68.com
303 {"xn--digklm68-b5a.com", L"digklm\x00f8" L"68.com", false}, // digklmø68.com
304 {"xn--digklmo8-h7g.com", L"digklmo\x0431" L"8.com", false}, // digklmoб8.com
305 {"xn--digklmo6-7yr.com", L"digklmo6\x09ea.com", false}, // digklmo6৪.com
306
307 // 'islkpx123.com' is listed for unitest in the top domain list.
308 // 'іѕӏкрх123' can look like 'islkpx123' in some fonts.
309 {"xn--123-bed4a4a6hh40i.com",
310 L"\x0456\x0455\x04cf\x043a\x0440\x0445" L"123.com", false},
311
284 // Mixed digits: the first two will also fail mixed script test 312 // Mixed digits: the first two will also fail mixed script test
285 // Latin + ASCII digit + Deva digit 313 // Latin + ASCII digit + Deva digit
286 {"xn--asc1deva-j0q.co.in", L"asc1deva\x0967.co.in", false}, 314 {"xn--asc1deva-j0q.co.in", L"asc1deva\x0967.co.in", false},
287 // Latin + Deva digit + Beng digit 315 // Latin + Deva digit + Beng digit
288 {"xn--devabeng-f0qu3f.co.in", L"deva\x0967" L"beng\x09e7.co.in", false}, 316 {"xn--devabeng-f0qu3f.co.in", L"deva\x0967" L"beng\x09e7.co.in", false},
289 // ASCII digit + Deva digit 317 // ASCII digit + Deva digit
290 {"xn--79-v5f.co.in", L"7\x09ea" L"9.co.in", false}, 318 {"xn--79-v5f.co.in", L"7\x09ea" L"9.co.in", false},
291 // Deva digit + Beng digit 319 // Deva digit + Beng digit
292 {"xn--e4b0x.co.in", L"\x0967\x09e7.co.in", false}, 320 {"xn--e4b0x.co.in", L"\x0967\x09e7.co.in", false},
293 // U+4E00 (CJK Ideograph One) is not a digit 321 // U+4E00 (CJK Ideograph One) is not a digit
(...skipping 13 matching lines...) Expand all
307 {"xn--58db0a9q.com", L"\x13df\x13aa\x13a1\x13a0.com", false}, 335 {"xn--58db0a9q.com", L"\x13df\x13aa\x13a1\x13a0.com", false},
308 // Scripts excluded from Identifiers: UTS 31 Table 4 336 // Scripts excluded from Identifiers: UTS 31 Table 4
309 // Coptic 337 // Coptic
310 {"xn--5ya.com", L"\x03e7.com", false}, 338 {"xn--5ya.com", L"\x03e7.com", false},
311 // Old Italic 339 // Old Italic
312 {"xn--097cc.com", L"\U00010300\U00010301.com", false}, 340 {"xn--097cc.com", L"\U00010300\U00010301.com", false},
313 341
314 // U+115F (Hangul Filler) 342 // U+115F (Hangul Filler)
315 {"xn--osd3820f24c.kr", L"\xac00\xb098\x115f.kr", false}, 343 {"xn--osd3820f24c.kr", L"\xac00\xb098\x115f.kr", false},
316 {"www.xn--google-ho0coa.com", L"www.\x2039google\x203a.com", false}, 344 {"www.xn--google-ho0coa.com", L"www.\x2039google\x203a.com", false},
317 // Latin small capital w 345 // Latin small capital w: hardᴡare.com
318 {"xn--hardare-l41c.com", L"hard\x1d21" L"are.com", false}, 346 {"xn--hardare-l41c.com", L"hard\x1d21" L"are.com", false},
319 // Minus Sign(U+2212) 347 // Minus Sign(U+2212)
320 {"xn--t9g238xc2a.jp", L"\x65e5\x2212\x672c.jp", false}, 348 {"xn--t9g238xc2a.jp", L"\x65e5\x2212\x672c.jp", false},
321 // Latin Small Letter Script G 349 // Latin Small Letter Script G: ɡɡ.com
322 {"xn--0naa.com", L"\x0261\x0261.com", false}, 350 {"xn--0naa.com", L"\x0261\x0261.com", false},
323 // Hangul Jamo(U+11xx) 351 // Hangul Jamo(U+11xx)
324 {"xn--0pdc3b.com", L"\x1102\x1103\x1110.com", false}, 352 {"xn--0pdc3b.com", L"\x1102\x1103\x1110.com", false},
325 // degree sign 353 // degree sign: 36°c.com
326 {"xn--36c-tfa.com", L"36\x00b0" L"c.com", false}, 354 {"xn--36c-tfa.com", L"36\x00b0" L"c.com", false},
327 // Pound sign 355 // Pound sign
328 {"xn--5free-9ga.com", L"5free\x00a8.com", false}, 356 {"xn--5free-9ga.com", L"5free\x00a8.com", false},
329 // Hebrew points (U+05B0, U+05B6) 357 // Hebrew points (U+05B0, U+05B6)
330 {"xn--7cbl2kc2a.com", L"\x05e1\x05b6\x05e7\x05b0\x05e1.com", false}, 358 {"xn--7cbl2kc2a.com", L"\x05e1\x05b6\x05e7\x05b0\x05e1.com", false},
331 // Danda(U+0964) 359 // Danda(U+0964)
332 {"xn--81bp1b6ch8s.com", L"\x0924\x093f\x091c\x0964\x0930\x0940.com", false}, 360 {"xn--81bp1b6ch8s.com", L"\x0924\x093f\x091c\x0964\x0930\x0940.com", false},
333 // Small letter script G(U+0261) 361 // Small letter script G(U+0261)
334 {"xn--oogle-qmc.com", L"\x0261oogle.com", false}, 362 {"xn--oogle-qmc.com", L"\x0261oogle.com", false},
335 // Small Katakana Extension(U+31F1) 363 // Small Katakana Extension(U+31F1)
336 {"xn--wlk.com", L"\x31f1.com", false}, 364 {"xn--wlk.com", L"\x31f1.com", false},
337 // Heart symbol 365 // Heart symbol: ♥
338 {"xn--ab-u0x.com", L"ab\x2665.com", false}, 366 {"xn--ab-u0x.com", L"ab\x2665.com", false},
339 // Emoji 367 // Emoji
340 {"xn--vi8hiv.xyz", L"\U0001f355\U0001f4a9.xyz", false}, 368 {"xn--vi8hiv.xyz", L"\U0001f355\U0001f4a9.xyz", false},
341 // Registered trade mark 369 // Registered trade mark
342 {"xn--egistered-fna.com", L"\x00ae" L"egistered.com", false}, 370 {"xn--egistered-fna.com", L"\x00ae" L"egistered.com", false},
343 // Latin Letter Retroflex Click 371 // Latin Letter Retroflex Click
344 {"xn--registered-25c.com", L"registered\x01c3.com", false}, 372 {"xn--registered-25c.com", L"registered\x01c3.com", false},
345 // ASCII '!' not allowed in IDN 373 // ASCII '!' not allowed in IDN
346 {"xn--!-257eu42c.kr", L"\xc548\xb155!.kr", false}, 374 {"xn--!-257eu42c.kr", L"\xc548\xb155!.kr", false},
347 // 'GOOGLE' in IPA extension 375 // 'GOOGLE' in IPA extension: ɢᴏᴏɢʟᴇ
348 {"xn--1naa7pn51hcbaa.com", 376 {"xn--1naa7pn51hcbaa.com",
349 L"\x0262\x1d0f\x1d0f\x0262\x029f\x1d07.com", false}, 377 L"\x0262\x1d0f\x1d0f\x0262\x029f\x1d07.com", false},
350 // Padlock icon spoof. 378 // Padlock icon spoof.
351 {"xn--google-hj64e", L"\U0001f512google.com", false}, 379 {"xn--google-hj64e", L"\U0001f512google.com", false},
352 380
353 // Custom black list 381 // Custom black list
354 // Combining Long Solidus Overlay 382 // Combining Long Solidus Overlay
355 {"google.xn--comabc-k8d", L"google.com\x0338" L"abc", false}, 383 {"google.xn--comabc-k8d", L"google.com\x0338" L"abc", false},
356 // Hyphenation Point instead of Katakana Middle dot 384 // Hyphenation Point instead of Katakana Middle dot
357 {"xn--svgy16dha.jp", L"\x30a1\x2027\x30a3.jp", false}, 385 {"xn--svgy16dha.jp", L"\x30a1\x2027\x30a3.jp", false},
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 0, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, kNpos, kNpos, kNpos, kNpos, 1025 0, kNpos, kNpos, kNpos, kNpos, kNpos, kNpos, 0, kNpos, kNpos, kNpos, kNpos,
998 0, 1, 2, 3, 4, 5, 6, 7 1026 0, 1, 2, 3, 4, 5, 6, 7
999 }; 1027 };
1000 CheckAdjustedOffsets("http://user@foo.com/", kFormatUrlOmitAll, 1028 CheckAdjustedOffsets("http://user@foo.com/", kFormatUrlOmitAll,
1001 net::UnescapeRule::NORMAL, omit_all_offsets); 1029 net::UnescapeRule::NORMAL, omit_all_offsets);
1002 } 1030 }
1003 1031
1004 } // namespace 1032 } // namespace
1005 1033
1006 } // namespace url_formatter 1034 } // namespace url_formatter
OLDNEW
« components/url_formatter/idn_spoof_checker.h ('K') | « components/url_formatter/url_formatter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698