Hacking Slack using postMessage and WebSocket-reconnect to steal your token
The mitigation creating an a element seems a little bit awkward:<p><pre><code>    if (!TS.utility.calls.verifyOriginUrl(evt.origin)) {
      return
    }
    ...
    verifyOriginUrl: function(originHref) {
            var a = document.createElement("a");
            a.href = originHref;
            return a.hostname == window.location.hostname
    },
</code></pre>
Is there a JS API for getting the host name from an origin, or is creating DOM elements the way to do this?