Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up(Do not merge) Partially implement blocking as mixed content #16320
Conversation
highfive
commented
Apr 9, 2017
|
Heads up! This PR modifies the following files:
|
highfive
commented
Apr 9, 2017
|
@bors-servo try |
(Do not merge) Partially implement blocking as mixed content
|
|
|
This covers the script and style cases from #8582, AFAICT. |
|
This should modify script/layout_image.rs as well. |
|
I'm interested in having @avadacatavra review this. |
|
Reviewed 7 of 7 files at r1, 1 of 1 files at r2, 1 of 1 files at r3, 19 of 19 files at r4. components/net/http_loader.rs, line 1178 at r2 (raw file):
do we want to panic here or return an error? Comments from Reviewable |
| @@ -1102,6 +1105,18 @@ fn http_network_fetch(request: &Request, | |||
| response.headers = res.response.headers.clone(); | |||
| response.referrer = request.referrer.to_url().cloned(); | |||
|
|
|||
| { | |||
| let http_message = res.response.get_ref().downcast_ref::<Http11Message>().unwrap(); | |||
This comment has been minimized.
This comment has been minimized.
avadacatavra
Apr 11, 2017
Contributor
all of this is to figure out if the response is served over https, right?
This comment has been minimized.
This comment has been minimized.
nox
Apr 11, 2017
Author
Member
Yes. I could more simply just check that the request's URL scheme was "https", but this checks that the very stream that handles the bits over the wire actually uses an HttpsStream, so I think that is better. And we will need that code when we will finally look at the actual cypher anyway.
This comment has been minimized.
This comment has been minimized.
| @@ -15,9 +15,9 @@ brotli = "1.0.6" | |||
| cookie = "0.6" | |||
| devtools_traits = {path = "../devtools_traits"} | |||
| flate2 = "0.2.0" | |||
| hyper = "0.10" | |||
| hyper = "0.10.8" | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| hyper_serde = "0.6" | ||
| hyper-openssl = "0.2.2" | ||
| hyper-openssl = "0.2.6" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nox
Apr 11, 2017
Author
Member
Same reason, though I ended up not using the lock function I introduced in 0.2.6, given we don't need to look at the cipher yet.
| @@ -255,7 +271,12 @@ pub fn main_fetch(request: &mut Request, | |||
| // TODO: handle blocking by content security policy. | |||
| let blocked_error_response; | |||
| let internal_response = | |||
| if should_replace_with_nosniff_error { | |||
| if should_replace_with_mixed_content_error { | |||
This comment has been minimized.
This comment has been minimized.
| is_potentially_trustworthy_url(url.as_url()) || url.scheme() == "data" | ||
| } | ||
|
|
||
| /// https://www.w3.org/TR/secure-contexts/#is-url-trustworthy |
This comment has been minimized.
This comment has been minimized.
| is_potentially_trustworthy_origin(url.origin()) | ||
| } | ||
|
|
||
| /// https://www.w3.org/TR/secure-contexts/#is-origin-trustworthy |
This comment has been minimized.
This comment has been minimized.
|
r? @jdm |
| unsafe_request: true, | ||
| // XXXManishearth figure out how to avoid this clone | ||
| body: extracted_or_serialized.as_ref().map(|e| e.0.clone()), | ||
| // TODO: handle request's client. |
This comment has been minimized.
This comment has been minimized.
|
|
||
| // Steps 3-4. | ||
| // TODO: handle whether response is an opaque filtered response. | ||
| // https://github.com/servo/servo/issues/16355 |
This comment has been minimized.
This comment has been minimized.
|
|
||
| /// https://w3c.github.io/webappsec-mixed-content/#categorize-settings-object | ||
| pub fn target_browsing_context_has_parent_browsing_context(&self) -> bool { | ||
| self.is_top_level() |
This comment has been minimized.
This comment has been minimized.
| if responsible_document.https_state() != HttpsState::None { | ||
| return true; | ||
| } | ||
| match responsible_document.window().parent_info() { |
This comment has been minimized.
This comment has been minimized.
jdm
May 1, 2017
Member
This is broken for cross-origin iframes. We will need to talk to the constellation to make this work correctly.
|
|
|
@nox what's the status on this? |
|
Closing due to inactivity; tracking in #19243. |
nox commentedApr 9, 2017
•
edited by larsbergstrom
This change is