From f0d1c7ea22d009a80838ac062f492732796fcbaf Mon Sep 17 00:00:00 2001 From: crowlkats Date: Fri, 28 Jan 2022 18:06:54 +0100 Subject: [PATCH] Forbid | in URL hosts --- url/src/host.rs | 2 ++ url/tests/urltestdata.json | 45 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/url/src/host.rs b/url/src/host.rs index d0a559589..11811c80e 100644 --- a/url/src/host.rs +++ b/url/src/host.rs @@ -107,6 +107,7 @@ impl Host { | ']' | '^' | '\u{007F}' + | '|' ) }; @@ -146,6 +147,7 @@ impl Host { | '\\' | ']' | '^' + | '|' ) }; diff --git a/url/tests/urltestdata.json b/url/tests/urltestdata.json index 290932785..c1f424d99 100644 --- a/url/tests/urltestdata.json +++ b/url/tests/urltestdata.json @@ -4707,6 +4707,11 @@ "base": "about:blank", "failure": true }, + { + "input": "sc://a|b/", + "base": "about:blank", + "failure": true + }, "Forbidden host codepoints: tabs and newlines are removed during preprocessing", { "input": "foo://ho\u0009st/", @@ -4931,6 +4936,11 @@ "base": "about:blank", "failure": true }, + { + "input": "http://a|b/", + "base": "about:blank", + "failure": true + }, { "input": "http://a\u007Fb/", "base": "about:blank", @@ -5200,6 +5210,11 @@ "base": "about:blank", "failure": true }, + { + "input": "http://ho%7Cst/", + "base": "about:blank", + "failure": true + }, { "input": "http://ho%7Fst/", "base": "about:blank", @@ -5777,6 +5792,36 @@ "base": "about:blank", "failure": true }, + { + "input": "file://%43%7C", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43|", + "base": "about:blank", + "failure": true + }, + { + "input": "file://C%7C", + "base": "about:blank", + "failure": true + }, + { + "input": "file://%43%7C/", + "base": "about:blank", + "failure": true + }, + { + "input": "https://%43%7C/", + "base": "about:blank", + "failure": true + }, + { + "input": "asdf://%43|/", + "base": "about:blank", + "failure": true + }, { "input": "asdf://%43%7C/", "base": "about:blank",