<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/authorizing-the-websocket-handshake-is-not-authorizing-every-message-z1chnkpnb" -->

---
title: Authorizing the WebSocket handshake is not authorizing...
description: A recurring security flaw is described: applications often check authorization only once, at WebSocket connection time, and then trust every subsequent message...
canonical: https://daily.dev/posts/authorizing-the-websocket-handshake-is-not-authorizing-every-message-z1chnkpnb
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Authorizing the WebSocket handshake is not authorizing every message | daily.dev
og:description: A recurring security flaw is described: applications often check authorization only once, at WebSocket connection time, and then trust every subsequent message...
og:url: https://daily.dev/posts/authorizing-the-websocket-handshake-is-not-authorizing-every-message-z1chnkpnb
og:image: https://api.daily.dev/og/posts/Z1chNKPNB.png
og:image:alt: Authorizing the WebSocket handshake is not authorizing every message
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Authorizing the WebSocket handshake is not authorizing every message

**[Auth By Example](https://daily.dev/sources/7eadcwhmohx0bchehapmt)** · [@authbyexample](https://daily.dev/authbyexample) · 1 min read · 0 upvotes · 0 comments

## Summary

A recurring security flaw is described: applications often check authorization only once, at WebSocket connection time, and then trust every subsequent message on that connection. But permissions can change mid-session through revokes, role changes, or tenant switches. Every command or subscription message sent over an open socket should be re-authorized against current policy rather than relying on the snapshot taken when the connection was established.

## Content

Many apps check authz once when the WebSocket connects, then treat every later frame as trusted. That is the same mistake as authorizing a session at login and never again.

Revokes, role changes, and tenant switches can happen while the socket is still open. For each command or subscription message, re-check that this caller may do this action on this resource in this tenant — using the current policy, not the permission snapshot from connect time.

A live connection is not a forever allow.

## Similar posts on daily.dev

- [The Loud Failure: How a Broken WebSocket Leaked a Master Key to the Backend](https://daily.dev/posts/the-loud-failure-how-a-broken-websocket-leaked-a-master-key-to-the-backend-g31k1oble) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Hardening Real-Time Matching Systems with Node.js and WebSockets](https://daily.dev/posts/hardening-real-time-matching-systems-with-node-js-and-websockets-niwsqbayc) · SitePoint · 0 upvotes · 0 comments

---

Tags: [#authentication](https://daily.dev/tags/authentication), [#appsec](https://daily.dev/tags/appsec), [#authorization](https://daily.dev/tags/authorization), [#websocket](https://daily.dev/tags/websocket)

[View this post on daily.dev](https://daily.dev/posts/authorizing-the-websocket-handshake-is-not-authorizing-every-message-z1chnkpnb)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/authorizing-the-websocket-handshake-is-not-authorizing-every-message-z1chnkpnb","headline":"Authorizing the WebSocket handshake is not authorizing every message","text":"A recurring security flaw is described: applications often check authorization only once, at WebSocket connection time, and then trust every subsequent message on that connection. But permissions can change mid-session through revokes, role changes, or tenant switches. Every command or subscription message sent over an open socket should be re-authorized against current policy rather than relying on the snapshot taken when the connection was established.","url":"https://daily.dev/posts/authorizing-the-websocket-handshake-is-not-authorizing-every-message-z1chnkpnb","datePublished":"2026-09-22T06:32:49.763Z","dateModified":"2026-09-22T06:33:02.379Z","author":{"@type":"Person","name":"Auth By Example","url":"https://daily.dev/authbyexample","image":"https://media.daily.dev/image/upload/s--Fgz7IgGQ--/f_auto/v1789653205/avatars/avatar_7EADCwHmOHX0bChEhAPmt?_a=BAMAMicg0","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":60}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/7eadcwhmohx0bchehapmt","name":"Auth By Example"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Auth By Example","item":"https://daily.dev/sources/7eadcwhmohx0bchehapmt"},{"@type":"ListItem","position":3,"name":"Authorizing the WebSocket handshake is not authorizing every message"}]}
```

