On Jun 14, 8:52 pm, James Coglan <
jcog...@gmail.com> wrote:
> I know this works, but I want to know if I've introduced a security hole. If
> we're doing cookie-based auth as with the hack above, malicious script on
> the page will still be able to subscribe because it will send the same
> cookies as our code. By similar logic malicious code injected into a site
> can read any data a logged-in user has access to. So, I don't think I'm
> introducing capabilities the malicious script would not otherwise have.
Further to this: http-only cookies are valuable because if malicious
script steals a session cookie, it can post it to another server than
can carry on stealing user data after the browser window has closed.
This scheme, on the other hand, exposes tokens with very limited
utility, i.e. subscribing to the site's message bus, without leaking
the session cookies that would give an attacker access to the user's
entire identity. Obviously, since we're trying to protect the message
bus I assume there is sensitive data going over it, so leaking a token
that provides access to it is undesirable.
Could this be solved by making the token very short-lived? Or is there
a better way? Should I bite the bullet and add filtering at the
network transport level? I'm not sure how this would affect WebSocket,
and I've no idea how many people need this functionality.