V
V
Vanik Khachatryan2018-04-08 18:52:43
Socket.io
Vanik Khachatryan, 2018-04-08 18:52:43

How to protect Socket.io from client injection?

How to make sure that the client cannot call and edit anything through a simple browser console, and protect it from connecting from other sites?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Koteezy, 2018-04-09
@VaniXac

No way. But you can change the subscription data, for example, if you have a channel:
App.User.{userId}
Instead of a user ID, use some hash that will change every few hours. Thus, it is impossible to avoid unauthorized connection to the room, but this will somewhat complicate the process of random connection to rooms.

S
SagePtr, 2018-04-08
@SagePtr

Nothing, everything that a browser can do, the client can do, pretending to be a browser

V
Viktor, 2018-04-09
@Levhav

To protect against connections from other sites, check the Origin header. Of course it can be faked. But regular browsers don't allow modifying this header from JavaScript

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question