From 2a6e23419e4bc4e6b1f9f756a6e20fea0de8742a Mon Sep 17 00:00:00 2001 From: anupamme Date: Wed, 16 Sep 2026 00:12:13 +0000 Subject: [PATCH] fix: utils.custom.sql-injection-template-literal security vulnerability Automated security fix generated by OrbisAI Security --- packages/socket.io-postgres-emitter/lib/index.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/socket.io-postgres-emitter/lib/index.ts b/packages/socket.io-postgres-emitter/lib/index.ts index 76ab377237..b017dde0fb 100644 --- a/packages/socket.io-postgres-emitter/lib/index.ts +++ b/packages/socket.io-postgres-emitter/lib/index.ts @@ -97,6 +97,9 @@ export class Emitter< const channelPrefix = opts.channelPrefix || "socket.io"; this.channel = `${channelPrefix}#${nsp}`; this.tableName = opts.tableName || "socket_io_attachments"; + if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(this.tableName)) { + throw new Error("invalid tableName"); + } this.payloadThreshold = opts.payloadThreshold || 8000; } @@ -399,7 +402,9 @@ export class BroadcastOperator< this.emitter.channel, ); const result = await this.emitter.pool.query( - `INSERT INTO ${this.emitter.tableName} (payload) VALUES ($1) RETURNING id;`, + "INSERT INTO " + + this.emitter.tableName + + " (payload) VALUES ($1) RETURNING id;", [payload], ); const attachmentId = result.rows[0].id;