Skip to content

Web-socket server with no origin check

Partialmedium severity · reads .ts .tsx .js .jsx .mjs .cjsBeta

Browsers don't stop other sites opening a web socket to you, so a page on any site can use a signed-in visitor's cookies against it (cross-site WebSocket hijacking, CWE-1385). When Lintsure finds this, it marks it as Partial: it may be fine, depending on context only you can confirm.

What it looks like

A line Lintsure flags in its own test app:

// web/learned.ts
export const wss = new WebSocketServer({ port: 8080 });

How to fix it

Check the Origin header when a connection opens (verifyClient in ws, cors.origin or allowRequest in socket.io) and allow only your own sites.

Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.

Controls it relates to

What the framework asks

OWASP Top 10 A01:2025: Broken Access Control

People must only reach the data and actions meant for them. This covers file paths, redirects, requests your server makes on a user's behalf (SSRF), forged requests from other sites, and permissions kept where users can change them.

Evidence a reviewer may ask for: A list of roles and what each may do, and tests showing one user can't read or change another user's data.

Summaries are our own reading of the public texts, not the official wording.

Check your code for this

Runs on your machine. Your code is never uploaded.

npx lintsure scan

Quickstart · Use it in Claude Code or Cursor

This rule is in Beta: its mapping to framework controls is our own reading of the public texts, not independently reviewed. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer

We improve these rules all the time. If you see a false alarm, a missed problem or anything that could work better, tell us in a review and we will use it to improve your experience.

Related rules

Did this rule flag something that's fine, or miss a real problem? Tell us on GitHub. Every report becomes a test case, so the same mistake can't come back.