diff options
author | Eitan Mosenkis <eitan@mosenkis.net> | 2015-12-08 23:49:36 +0200 |
---|---|---|
committer | Dongie Agnir <dongie.agnir@gmail.com> | 2016-04-01 16:15:55 -1000 |
commit | e546637d917267f21e8e9d85808d7e2d2abeea6a (patch) | |
tree | b5ebe05178c1ae4e9dc2a6ad5dfef55a5f5b978d /components/script/cors.rs | |
parent | 9d6d1c66b894d37e902cef094659898c1362f5e8 (diff) | |
download | servo-e546637d917267f21e8e9d85808d7e2d2abeea6a.tar.gz servo-e546637d917267f21e8e9d85808d7e2d2abeea6a.zip |
Restrict about to about:blank and data to GET
Diffstat (limited to 'components/script/cors.rs')
-rw-r--r-- | components/script/cors.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/components/script/cors.rs b/components/script/cors.rs index f60dc3a7c78..56a5e609427 100644 --- a/components/script/cors.rs +++ b/components/script/cors.rs @@ -74,12 +74,11 @@ impl CORSRequest { match &*destination.scheme { // As per (https://fetch.spec.whatwg.org/#main-fetch 5.1.9), about URLs can be fetched // the same as a basic request. - // TODO: (security-sensitive) restrict the available pages to about:blank and - // about:unicorn (See https://fetch.spec.whatwg.org/#concept-basic-fetch). - "about" => Ok(None), + "about" if destination.path == Some("blank") => Ok(None), // As per (https://fetch.spec.whatwg.org/#main-fetch 5.1.9), data URLs can be fetched - // the same as a basic request if the request's same-origin data-URL flag is set. - "data" if same_origin_data_url_flag => Ok(None), + // the same as a basic request if the request's method is GET and the + // same-origin data-URL flag is set. + "data" if same_origin_data_url_flag && method == Method::Get => Ok(None), "http" | "https" => { let mut req = CORSRequest::new(referer, destination, mode, method, headers); req.preflight_flag = !is_simple_method(&req.method) || |