Skip to content

Implement HSTS #14363

Closed

Description

@Ms2ger
No description provided.

Activity

  1. frewsxcv commented on Nov 27, 2016

    @frewsxcv
    Contributor

    Relevant section:

    https://fetch.spec.whatwg.org/#main-fetch

    Part of step 9:

    Matching request’s current url’s host per Known HSTS Host Domain Name Matching results in either a superdomain match with an asserted includeSubDomains directive or a congruent match (with or without an asserted includeSubDomains directive) [HSTS]

  2. frewsxcv commented on Dec 8, 2016

    @frewsxcv
    Contributor

    Related: #8580

  3. added 3 commits that reference this issue on Dec 28, 2016
  4. Darkspirit commented on Dec 24, 2019

    @Darkspirit
    SponsorContributor

    Please reopen. This issue was filed for the regression caused by #14360 (comment):
    It removed the function that added received HSTS headers to the internal HSTS database. Since then, only Preloaded entries are applied. The PR that closed this issue did not add it back.

    Only these cases are tested:

    Not tested:

    • HSTS header received via https is added to the internal database

    Likely not tested:

    • ws:// is upgraded to wss://
    • HSTS header received via wss:// is added to the internal database

    Originally I was just asking myself, if ws:// gets upgraded to wss:// by current code. It doesn't seem so.
    https://fetch.spec.whatwg.org/#websocket-opening-handshake

    This upgrades http to https:

    // Step 10.
    context
    .state
    .hsts_list
    .read()
    .unwrap()
    .switch_known_hsts_host_domain_url_to_https(request.current_url_mut());

    If websocket requests go through this function, ws to wss upgrades could be done here as well:
    /// Step 10 of https://fetch.spec.whatwg.org/#concept-main-fetch.
    pub fn switch_known_hsts_host_domain_url_to_https(&self, url: &mut ServoUrl) {
    if url.scheme() != "http" {
    return;
    }
    if url
    .domain()
    .map_or(false, |domain| self.is_host_secure(domain))
    {
    url.as_mut_url().set_scheme("https").unwrap();
    }
    }

    Otherwise, a call to switch_known_hsts_host_domain_url_to_https() could be added after this code:

    let scheme = req_builder.url.scheme();
    let mut req_url = req_builder.url.clone();
    if scheme == "ws" {
    req_url.as_mut_url().set_scheme("http").unwrap();
    } else if scheme == "wss" {
    req_url.as_mut_url().set_scheme("https").unwrap();
    }

  5. jdm commented on Dec 24, 2019

    @jdm
    Member

    Thanks for checking!

  6. reopened this on Dec 24, 2019
  7. Darkspirit commented on Dec 24, 2019

    @Darkspirit
    SponsorContributor

    Along this, it would be good to add these prefs to switch_known_hsts_host_domain_url_to_https():

    • "network.enforce_https.enabled": false, with the following exceptions:
      • "network.enforce_https.localhost": false, (incl. loopback IPs)
      • "network.enforce_https.onion": false,

    This would also address #20120. The same should be done for Firefox: bug 1335590

  8. Darkspirit commented on Dec 25, 2019

    @Darkspirit
    SponsorContributor

    @highfive assign me

  9. added
    C-assigned
    on Dec 25, 2019
  10. highfive commented on Dec 25, 2019

    @highfive

    Hey @Darkspirit! Thanks for your interest in working on this issue. It's now assigned to you!

  11. added 6 commits that reference this issue on Jan 8, 2020
    96bb571
    f95e999
    0f6ad77
    080e66f
    2a61745
    e201b16
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

    A-networkC-assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions