Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(pam): use RE2 for trailing semicolon regex to prevent ReDoS
bernie-gd27e3bc5fcb2
diff --git a/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts b/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.tsindex 185a02c804..90aacb13b3 100644--- a/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts+++ b/backend/src/ee/services/pam-web-access/pam-postgres-session-handler.ts@@ -1,6 +1,7 @@import { parse as parseSql } from "libpg-query";import pg from "pg";import Cursor from "pg-cursor";+import RE2 from "re2";import {TPostgresAccountCredentials,@@ -255,7 +256,7 @@ export const handlePostgresSession = async (const location = s.stmt_location ?? 0;return s.stmt_len !== undefined? message.sql.slice(location, location + s.stmt_len)- : message.sql.slice(location).trimEnd().replace(/;+$/, "").trim();+ : message.sql.slice(location).trimEnd().replace(new RE2(";+$"), "").trim();});let lastRows: Record<string, unknown>[] = [];