Skip to content

Commit 4f043f9

Browse files
committed
Securing websockets
1 parent 9cdb897 commit 4f043f9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/api/integrations/event/websocket/websocket.controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ export class WebsocketController extends EventController implements EventControl
2828
allowRequest: async (req, callback) => {
2929
try {
3030
const url = new URL(req.url || '', 'http://localhost');
31+
const isInternalConnection = req.socket.remoteAddress === '127.0.0.1' || req.socket.remoteAddress === '::1';
3132
const params = new URLSearchParams(url.search);
3233

3334
// Permite conexões internas do Socket.IO (EIO=4 é o Engine.IO v4)
34-
if (params.has('EIO')) {
35+
if (params.has('EIO') && isInternalConnection) {
3536
return callback(null, true);
3637
}
3738

0 commit comments

Comments
 (0)