AI-built apps add live features fast: chat, notifications, live dashboards. Many use WebSockets or Socket.IO. The HTTP part of the app often has a login check. The socket often does not.

The gap

A normal API route is protected because each request carries a session or token and the server checks it. A WebSocket connects once and then stays open. If the server accepts the connection without checking who is connecting, every message after that is trusted. Generated socket code often does exactly that: io.on("connection", ...) with no check.

What goes wrong

  • Anyone can connect. A stranger opens a connection from their own page or a script and listens.
  • Rooms are guessable. If a room name is a user id or an order number, a stranger can join someone else's room by guessing.
  • Messages are not checked. The server broadcasts whatever a client sends, including to other users' rooms.
  • Origin is not checked. A malicious web page can open a socket to your server using a visitor's logged-in browser. This is called cross-site WebSocket hijacking.

How to check your own app

  1. In your browser's Network tab, filter by WS. Note the socket URL your app opens.
  2. Open that URL from a private window or a small script, without signing in. Does the connection stay open?
  3. Check what you receive. If you see another user's data, the gap is real.
  4. In your server code, find the connection handler. Does it verify a token or session before it accepts the connection?

Fixes

  • Verify a token or session in the connection handshake. Reject the connection if it is missing or invalid.
  • Check on the server that the user may join each room. Never trust a room name from the client.
  • Validate the Origin header against your own domains.
  • Rate limit messages per connection.
  • Use wss://, not ws://.

Check the outside view

I work on ProofForge. The free scan checks the public side of a URL you own or have permission to test: browser bundle, public files, headers and supported backend signals. It never signs in. A clean result means nothing was found in the public assets checked, not that the app is secure. It does not test live socket connections, so use the steps above for that.

Run the free scan on the live URL. Run the free ProofForge scan. No account needed. Only scan apps you own or have permission to test. More guides: the index.