From e452e1d70a8257c0238558c58f4b6ad9f09b0002 Mon Sep 17 00:00:00 2001 From: Alwin Blok Date: Sun, 6 Jun 2021 14:24:52 +0200 Subject: [PATCH 1/2] Tests for forbidden host code-points and resolution of non-special URLs --- url/resources/urltestdata.json | 199 +++++++++++++++++++++++++++++++++ 1 file changed, 199 insertions(+) diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json index 96c42d2284ebf7..8df3ccd9ecc240 100644 --- a/url/resources/urltestdata.json +++ b/url/resources/urltestdata.json @@ -7794,5 +7794,204 @@ "protocol": "wss:", "search": "", "username": "" + }, + "Forbidden host codepoints", + { "input": "foo://ho\u0000st/", + "base": "about:blank", + "failure": true + }, + { "input": "foo://host/", + "base": "about:blank", + "failure": true + }, + { "input": "foo://ho^st/", + "base": "about:blank", + "failure": true + }, + { "input": "foo://ho|st/", + "base": "about:blank", + "failure": true + }, + "Forbidden host codepoints: tabs and newlines are removed during preprocessing", + { "input": "foo://ho\u0009st/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { "input": "foo://ho\u000Ast/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { "input": "foo://ho\u000Dst/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + "Encoded forbidden host codepoints in special URLs", + { + "input": "http://ho%00st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%09st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%20st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%23st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%2Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Est/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%40st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Bst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%7Cst/", + "base": "about:blank", + "failure": true + }, + "Ensure that non-special URLs use strict resolution", + { + "input": "abc:rootless", + "base": "abc://host/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", + "password": "", + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + { + "input": "abc:rootless", + "base": "abc:/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", + "password": "", + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + { + "input": "abc:rootless", + "base": "abc:path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:rootless", + "password": "", + "pathname": "rootless", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" + }, + { + "input": "abc:/rooted", + "base": "abc://host/path", + "hash": "", + "host": "", + "hostname": "", + "href":"abc:/rooted", + "password": "", + "pathname": "/rooted", + "port":"", + "protocol": "abc:", + "search": "", + "username": "" } ] From bce239211156f0b4d88681cfec2a5167d96841f5 Mon Sep 17 00:00:00 2001 From: Alwin Blok Date: Tue, 8 Jun 2021 23:53:51 +0200 Subject: [PATCH 2/2] Move tests up; slight formatting changes; rephrase comment --- url/resources/urltestdata.json | 281 ++++++++++++++++----------------- 1 file changed, 137 insertions(+), 144 deletions(-) diff --git a/url/resources/urltestdata.json b/url/resources/urltestdata.json index 8df3ccd9ecc240..2acc35f90ee9be 100644 --- a/url/resources/urltestdata.json +++ b/url/resources/urltestdata.json @@ -4698,6 +4698,140 @@ "base": "about:blank", "failure": true }, + { + "input": "foo://ho\u0000st/", + "base": "about:blank", + "failure": true + }, + { + "input": "foo://ho|st/", + "base": "about:blank", + "failure": true + }, + "Forbidden host codepoints: tabs and newlines are removed during preprocessing", + { + "input": "foo://ho\u0009st/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "input": "foo://ho\u000Ast/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + { + "input": "foo://ho\u000Dst/", + "base": "about:blank", + "hash": "", + "host": "host", + "hostname": "host", + "href":"foo://host/", + "password": "", + "pathname": "/", + "port":"", + "protocol": "foo:", + "search": "", + "username": "" + }, + "Encoded forbidden host codepoints in special URLs", + { + "input": "http://ho%00st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%09st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%0Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%20st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%23st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%2Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Ast/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Est/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%3Fst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%40st/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Bst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Cst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%5Dst/", + "base": "about:blank", + "failure": true + }, + { + "input": "http://ho%7Cst/", + "base": "about:blank", + "failure": true + }, "Allowed host code points", { "input": "http://\u001F!\"$&'()*+,-.;=_`{}~/", @@ -7676,7 +7810,8 @@ "search": "", "username": "joe" }, - { "input": "foo://!\"$%&'()*+,-.;=_`{}~/", + { + "input": "foo://!\"$%&'()*+,-.;=_`{}~/", "base": "about:blank", "hash": "", "host": "!\"$%&'()*+,-.;=_`{}~", @@ -7795,149 +7930,7 @@ "search": "", "username": "" }, - "Forbidden host codepoints", - { "input": "foo://ho\u0000st/", - "base": "about:blank", - "failure": true - }, - { "input": "foo://host/", - "base": "about:blank", - "failure": true - }, - { "input": "foo://ho^st/", - "base": "about:blank", - "failure": true - }, - { "input": "foo://ho|st/", - "base": "about:blank", - "failure": true - }, - "Forbidden host codepoints: tabs and newlines are removed during preprocessing", - { "input": "foo://ho\u0009st/", - "base": "about:blank", - "hash": "", - "host": "host", - "hostname": "host", - "href":"foo://host/", - "password": "", - "pathname": "/", - "port":"", - "protocol": "foo:", - "search": "", - "username": "" - }, - { "input": "foo://ho\u000Ast/", - "base": "about:blank", - "hash": "", - "host": "host", - "hostname": "host", - "href":"foo://host/", - "password": "", - "pathname": "/", - "port":"", - "protocol": "foo:", - "search": "", - "username": "" - }, - { "input": "foo://ho\u000Dst/", - "base": "about:blank", - "hash": "", - "host": "host", - "hostname": "host", - "href":"foo://host/", - "password": "", - "pathname": "/", - "port":"", - "protocol": "foo:", - "search": "", - "username": "" - }, - "Encoded forbidden host codepoints in special URLs", - { - "input": "http://ho%00st/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%09st/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%0Ast/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%0Dst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%20st/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%23st/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%2Fst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%3Ast/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%3Cst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%3Est/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%3Fst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%40st/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%5Bst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%5Cst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%5Dst/", - "base": "about:blank", - "failure": true - }, - { - "input": "http://ho%7Cst/", - "base": "about:blank", - "failure": true - }, - "Ensure that non-special URLs use strict resolution", + "Ensure that input schemes are not ignored when resolving non-special URLs", { "input": "abc:rootless", "base": "abc://host/path",