Skip to content

WebSocket: move port restrictions move to Fetch #841

Closed

Description

@annevk

It's not entirely clear to me why WebSocket has port restrictions, but Fetch in general doesn't. Should that be generalized somehow?

Do we really want to surface these port restrictions as exceptions (making them easily testable) or should they become network errors?

Activity

  1. annevk commented on Mar 10, 2016

    @annevk
    MemberAuthor

    @tyoshino thoughts?

  2. tyoshino commented on Mar 10, 2016

    @tyoshino
    Member

    When the WebSockets were being introduced, people at HyBi worried much about it being abused for cross-protocol attacks. IIRC, it's a part of outcome of discussion on such concerns.

    The Blink side implementation of this was done in 2009 for WebKit based on the spec text in WHATWG spec.
    https://chromium.googlesource.com/chromium/src/+/37942cd0eaf481d2c52ddc30427683a5c9535752%5E%21/
    https://bugs.webkit.org/show_bug.cgi?id=32085
    The list was taken from http://www-archive.mozilla.org/projects/netlib/PortBanning.html.

    In Chromium, the HTTP stack also blocks access to ports for the same set of known legacy protocols as WebSockets. So, adding this requirement to Fetch would make itself close to our policy.
    https://code.google.com/p/chromium/codesearch#chromium/src/net/base/port_util.cc&l=22

    This list was already there since the initial commit of Chromium repo (2008-07-26). Maybe it's from the same source (Mozilla's one).

  3. tyoshino commented on Mar 10, 2016

    @tyoshino
    Member

    I haven't checked but I guess Firefox also has similar port blocking for HTTP. If so, it makes sense to incorporate it into the Fetch spec.

    Currently XHR in Chromium results in network error while WebSocket throws as you said. Regardless of the form of error adopted, the banned ports have been not working for Chromium. So, it shouldn't be a pain for us to converge the way of error notification.

  4. added a commit that references this issue on Mar 10, 2016
  5. changed the title [-]WebSocket: should port restrictions move to Fetch?[/-] [+]WebSocket: move port restrictions move to Fetch[/+] on Mar 10, 2016
  6. added
    good first issue
    on Mar 10, 2016
  7. annevk commented on Mar 10, 2016

    @annevk
    MemberAuthor

    Thank you @tyoshino, that was very helpful. I have added port blocking to Fetch. Per the commit listed above. My proposal is that we remove the port blocking from the WebSocket API since it's redundant.

  8. annevk commented on Mar 10, 2016

    @annevk
    MemberAuthor

    (I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1255386 against Gecko to align with the additions to the port blocklist made by WebKit/Chromium.)

  9. Ms2ger commented on Mar 10, 2016

    @Ms2ger
    Member
  10. added a commit that references this issue on Mar 16, 2016
    fb030c2
  11. added a commit that references this issue on Mar 17, 2016
  12. added a commit that references this issue on Mar 22, 2016
    17336ad
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

    good first issuenormative change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions