Skip to content
  • Matthew Draper's avatar
    549d7322
    Permit same-origin connections by default · 549d7322
    Matthew Draper authored
    WebSocket always defers the decision to the server, because it didn't
    have to deal with legacy compatibility... but the same-origin policy is
    still a reasonable default.
    
    Origin checks do not protect against a directly connecting attacker --
    they can lie about their host, but can also lie about their origin.
    Origin checks protect against a connection from 3rd-party controlled
    script in a context where a victim browser's cookies will be passed
    along. And if an attacker has breached that protection, they've already
    compromised the HTTP session, so treating the WebSocket connection in
    the same way seems reasonable.
    
    In case this logic proves incorrect (or anyone just wants to be more
    paranoid), we retain a config option to disable it.
    549d7322
    Permit same-origin connections by default
    Matthew Draper authored
    WebSocket always defers the decision to the server, because it didn't
    have to deal with legacy compatibility... but the same-origin policy is
    still a reasonable default.
    
    Origin checks do not protect against a directly connecting attacker --
    they can lie about their host, but can also lie about their origin.
    Origin checks protect against a connection from 3rd-party controlled
    script in a context where a victim browser's cookies will be passed
    along. And if an attacker has breached that protection, they've already
    compromised the HTTP session, so treating the WebSocket connection in
    the same way seems reasonable.
    
    In case this logic proves incorrect (or anyone just wants to be more
    paranoid), we retain a config option to disable it.
Loading