How does socket.io prevent session hijacking when polling transport is used? #4991
-
I implemented the auth middleware according to this example https://socket.io/how-to/use-with-jwt The main idea behind the middleware is to validate the token only during the handshake request. Once the socket connection is established and SID is assigned, the token is not re-validated and the server trusts the subsequent HTTP requests to the GET and POST /socket.io endpoints. I tried to duplicate one of the POST requests that is generated by socket.io-client when a message is emitted from the client to the server and to re-send it from insomnia. The request goes through even if all the headers generated by the socket.io-client are removed. The request looks somehow like this
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi!
Yes.
Yes.
The SID is generated by the See also: #3416 (comment) |
Beta Was this translation helpful? Give feedback.
Hi!
Yes.
Yes.
The SID is generated by the
base64id
package, which usescrypto.randomBytes
under the hood.See also: #3416 (comment)