Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Check the authenticity of incoming connection in the websocket 🔐 #1031

Closed
rhohma opened this issue Sep 15, 2022 · 1 comment
Closed

Check the authenticity of incoming connection in the websocket 🔐 #1031

rhohma opened this issue Sep 15, 2022 · 1 comment

Comments

@rhohma
Copy link

rhohma commented Sep 15, 2022

Hello,

I'm working on beyondcode/laravel-websockets and using a Pysher (python websocket https://github.com/deepbrook/Pysher) to connect to my laravel websocket server.

I've been looking for a solution to increase websocket security input/entry with something other than 'appKey' for several weeks.
Has anyone managed to implement anything other than this simple security with a easily accessible 'appKey'?

I thought about limiting entries by domain (websocket.php -> allowed_origins). But it doesn't suit me because my python connection will be outside the server's network.

I am currently working on the custom handler.
The only possibility I've imagined is to modify the onOpen function so that the user who instantiates a connection to the websocket provides me with a token.
I could ask to make an HTTP call on my API server with a bearer token, then send this token to the websocket connection onOpen, then check if the device opening the socket is an authorized user.

Am I off the mark? or the basic concept of the websocket is to allow anyone to open a socket connection?
If someone gets the websocket url they can flood the server and instantiate as many connections as they want? It's still amazing

Thanks,

@fredsal
Copy link

fredsal commented Sep 19, 2022

Maybe give you ideas
laravel/echo#340

@mpociot mpociot closed this as completed Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants