Skip to content

Github sign in is broken from http #8100

Closed

Description

@jdm

STR:
Visit http://github.com in servo, click "sign in" button. Enter username and password, click submit button.

Actual:
Get directed to page that says "Cookies must be enabled".

Expected:
Logged in.

This doesn't appear to happen for https://github.com.

Activity

  1. frewsxcv commented on Oct 21, 2015

    @frewsxcv
    Contributor

    GIF of this in action:

  2. Manishearth commented on Nov 30, 2015

    @Manishearth
    Member

    happening on HTTPS too

  3. Manishearth commented on Nov 30, 2015

    @Manishearth
    Member

    I think the same error is happening for Facebook and Wikipedia. I guess our cookies broke?

  4. jdm commented on Dec 4, 2015

    @jdm
    MemberAuthor

    The HTTPS thing was fixed by #8752.

  5. bobthekingofegypt commented on Feb 21, 2016

    @bobthekingofegypt
    Contributor

    Can I have a go at fixing this?

    As far as I can see it's being caused by the hsts functionality changing the request url to https but not sending the updated url to the cookies_for_url function, so secure cookies are not being sent.

  6. Manishearth commented on Feb 21, 2016

    @Manishearth
    Member

    Sure! Is this a spec issue (i.e. where we don't implement the spec correctly)?

    Let me know if you need help. I understand what HSTS is, but I don't know the internals of that or secure cookies (could read up if necessary), so I can't help you there, though.

  7. jdm commented on Feb 21, 2016

    @jdm
    MemberAuthor

    @bobthekingofegypt: good catch!

  8. bobthekingofegypt commented on Feb 21, 2016

    @bobthekingofegypt
    Contributor

    I don't think it's a spec issue, I think it's just an issue with the value that is passed to the cookie code. Each part individually seems to be correct, HSTS and the cookie store, just the values being sent from the http_loader to the cookie store are wrong.

    The code is correctly identifying that github should be on https (because it is in the HSTS list) and it is changing the url over, and makes the final call to the https url.
    https://github.com/servo/servo/blob/master/components/net/http_loader.rs#L695

    But when it attaches the cookies to be sent with the request, the originating url (the one before any hostname or HTST changes) is passed to the cookie code, not the updated one.
    https://github.com/servo/servo/blob/master/components/net/http_loader.rs#L728
    https://github.com/servo/servo/blob/master/components/net/http_loader.rs#L532

    The cookie code then correctly doesn't attach the secure cookie values as it thinks the request is going out to a plain http url.

    I'll dig into a little deeper this week, and also check how the hostname changes should effect the cookies sent .
    I need to detour a bit first, in order to learn how to write rust code!

  9. added a commit that references this issue on Feb 27, 2016
  10. added a commit that references this issue on Mar 9, 2016
    162e89d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions