Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSocket Auth #91

Closed
4 tasks done
mfornos opened this issue Jun 17, 2024 · 0 comments
Closed
4 tasks done

WebSocket Auth #91

mfornos opened this issue Jun 17, 2024 · 0 comments
Labels
analysis Task that needs research and investigation

Comments

@mfornos
Copy link
Contributor

mfornos commented Jun 17, 2024

We want authenticated and authorized WebSocket connections that work in the browser (ref. whatwg/websockets#16).

The well-known workarounds include:

  • Sending the auth token in query parameters
  • Sending it in an HTTP cookie
  • Using the Sec-WebSocket-Protocol hack
  • Sending it over the WebSocket itself

Each method has its own trade-offs.

Our choice is to send the authentication bearer token over the WebSocket itself, as it is the cleanest approach. To counteract the potential denial of service attack vector, we additionally include a "nod" token in the query parameters that we don't mind if it is leaked. The "nod" token is a JWT containing only the iat field and a proper signature.


  • Implement server side
  • Add anti-dos token issuance endpoint (to avoid more than one token in the client lib + short expiration)
  • Limit max requests x time period x IP address
  • Add "nod" support in the client library
@mfornos mfornos added feature analysis Task that needs research and investigation labels Jun 17, 2024
@mfornos mfornos changed the title WebSocket Authentitcation WebSocket Authentication Jun 17, 2024
@mfornos mfornos changed the title WebSocket Authentication WebSocket Auth Jun 17, 2024
mfornos added a commit that referenced this issue Jun 17, 2024
@XY-Wang XY-Wang closed this as completed Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analysis Task that needs research and investigation
Projects
None yet
Development

No branches or pull requests

2 participants