Commit ca67f9c9 authored by valenting's avatar valenting
Browse files

Bug 1790163 - Fix IDN spoofing 30FC r=necko-reviewers,jesup

parent ebc302cb
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -695,6 +695,12 @@ bool nsIDNService::isLabelSafe(const nsAString& label) {
      }
    }

    // U+30FC should be preceded by a Hiragana/Katakana.
    if (ch == 0x30fc && lastScript != Script::HIRAGANA &&
        lastScript != Script::KATAKANA) {
      return false;
    }

    // Check for mixed numbering systems
    auto genCat = GetGeneralCategory(ch);
    if (genCat == HB_UNICODE_GENERAL_CATEGORY_DECIMAL_NUMBER) {
+4 −4
Original line number Diff line number Diff line
@@ -229,13 +229,13 @@ let testCases = [
  // Hiragana + U+30FC + Han
  ["xn--u8j5tr47nw5ya.jp", "\u304b\u30fc\u91ce\u7403.jp", kSafe],
  // U+30FC + Han
  ["xn--weka801xo02a.com", "\u30fc\u52d5\u753b\u30fc.com", kUnsafe, "DISABLED"],
  ["xn--weka801xo02a.com", "\u30fc\u52d5\u753b\u30fc.com", kUnsafe],
  // Han + U+30FC + Han
  ["xn--wekz60nb2ay85atj0b.jp", "\u65e5\u672c\u30fc\u91ce\u7403.jp", kUnsafe, "DISABLED"],
  ["xn--wekz60nb2ay85atj0b.jp", "\u65e5\u672c\u30fc\u91ce\u7403.jp", kUnsafe],
  // U+30FC at the beginning
  ["xn--wek060nb2a.jp", "\u30fc\u65e5\u672c.jp", kUnsafe, "DISABLED"],
  ["xn--wek060nb2a.jp", "\u30fc\u65e5\u672c.jp", kUnsafe],
  // Latin + U+30FC + Latin
  ["xn--abcdef-r64e.jp", "abc\u30fcdef.jp", kUnsafe, "DISABLED"],
  ["xn--abcdef-r64e.jp", "abc\u30fcdef.jp", kUnsafe],

  // U+30FB (・) is not allowed next to Latin, but allowed otherwise.
  // U+30FB + Han