Merge pull request #1802 from frieck/main
Some checks failed
Build Docker image / Build and Deploy (push) Has been cancelled

Securing websockets
This commit is contained in:
Davidson Gomes 2025-08-04 19:18:30 -03:00 committed by GitHub
commit a8343a8739
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -30,8 +30,12 @@ export class WebsocketController extends EventController implements EventControl
const url = new URL(req.url || '', 'http://localhost');
const params = new URLSearchParams(url.search);
const { remoteAddress } = req.socket;
const isLocalhost =
remoteAddress === '127.0.0.1' || remoteAddress === '::1' || remoteAddress === '::ffff:127.0.0.1';
// Permite conexões internas do Socket.IO (EIO=4 é o Engine.IO v4)
if (params.has('EIO')) {
if (params.has('EIO') && isLocalhost) {
return callback(null, true);
}