Skip to content

correctly send secure cookies after hsts url match - #9780

Merged
bors-servo merged 4 commits into
servo:masterfrom
bobthekingofegypt:github_hsts_bug
Mar 9, 2016
Merged

bors-servo merged 4 commits into
servo:masterfrom
bobthekingofegypt:github_hsts_bug

Conversation

@bobthekingofegypt

Copy link
Copy Markdown
Contributor

Fixes #8100, where sites in the hsts list were not recieving secure
cookies if the site was originally loading using a plain http url.

Review on Reviewable

Fix for servo#8100, where sites in the hsts list were not recieving secure
cookies if the site was originally loading using a plain http url.
@highfive

Copy link
Copy Markdown

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @mbrubeck (or someone else) soon.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 27, 2016
@jdm

jdm commented Feb 27, 2016

Copy link
Copy Markdown
Member

Thank you for finding and solving this! I've filed #9783 to ensure we're not making this mistake in other places, too.

@jdm

jdm commented Feb 27, 2016

Copy link
Copy Markdown
Member

@bors-servo: r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 759099c has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 27, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 759099c with merge 32bed54...

bors-servo pushed a commit that referenced this pull request Feb 27, 2016
correctly send secure cookies after hsts url match

Fix for #8100, where sites in the hsts list were not recieving secure
cookies if the site was originally loading using a plain http url.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9780)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Feb 27, 2016
@jdm

jdm commented Feb 27, 2016

Copy link
Copy Markdown
Member
  ▶ Unexpected subtest result in /XMLHttpRequest/anonymous-mode-unsupported.htm:
  │ FAIL [expected PASS] XMLHttpRequest: anonymous mode unsupported
  │   → assert_equals: The deprecated anonymous:true should be ignored, cookie sent anyway expected "cookie: test=anonymous-mode-unsupported\n" but got ""
  │ 
  │ client.onreadystatechange<@http://web-platform.test:8000/XMLHttpRequest/anonymous-mode-unsupported.htm:22:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1381:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1405:1

We should look into why this test now fails with this change.

Changed hostname rewrite to happen inside obtain response after any htst
changes.  Removed  url from load leaving just doc_url to avoid confusion
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 1, 2016
@bobthekingofegypt

Copy link
Copy Markdown
Contributor Author

As discussed on IRC, the test was failing due to the hostname being modified by the HOST file entry in the test runner. This meant the cookies were incorrectly failing to match the host in the updated request cookies method, and not being sent.

Tried updating the code to move hostname changes inside obtain_response and remove the duplicate urls.

Ran this against the unit tests and WPT tests, I get some failures and timeouts on WPT but I get the same failures on master. I tried to test github site itself but I can't seem to press the final login button as the browser won't react to it.

Comment thread components/net/http_loader.rs Outdated
send_request_to_devtools(
devtools_chan.clone(), request_id.clone().into(),
url.clone(), method.clone(), request_headers.clone(),
connection_url.clone(), method.clone(), request_headers.clone(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be using url instead.

@jdm

jdm commented Mar 2, 2016

Copy link
Copy Markdown
Member

This looks great, with one small change necessary!

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 2, 2016

let cookie = Cookie::new_wrapped(
cookie_pair,
&cookie_url,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this HTTP as well, or else it's pretty confusing to read.

Send url that was not modified by the hosts file to the dev tools
Cleanup for readability and correctness of unit test in http_loader
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Mar 3, 2016
@jdm

jdm commented Mar 9, 2016

Copy link
Copy Markdown
Member

@bors-servo: r+
Thanks!

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 248e84e has been approved by jdm

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 9, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 248e84e with merge 162e89d...

bors-servo pushed a commit that referenced this pull request Mar 9, 2016
correctly send secure cookies after hsts url match

Fixes #8100, where sites in the hsts list were not recieving secure
cookies if the site was originally loading using a plain http url.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9780)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, status-appveyor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants