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
switch to re2
Maidul Islam050a5df6d83b
diff --git a/backend/src/db/sanitized-schema.ts b/backend/src/db/sanitized-schema.tsindex 5f65e69c45..b4e3e3153e 100644--- a/backend/src/db/sanitized-schema.ts+++ b/backend/src/db/sanitized-schema.ts@@ -1,6 +1,7 @@import { Knex } from "knex";import path from "path";import { Logger } from "pino";+import RE2 from "re2";import { PgSqlLock } from "@app/keystore/keystore";@@ -70,7 +71,8 @@ type TGrantArgs = TArgs & {export const grantSanitizedSchemaAccess = async ({ db, logger, role }: TGrantArgs): Promise<void> => {// Validate role name to prevent SQL injection- if (!/^[a-zA-Z0-9_-]+$/.test(role)) {+ const roleNameRegex = new RE2("^[a-zA-Z0-9_-]+$");+ if (!roleNameRegex.test(role)) {throw new Error(`SANITIZED_SCHEMA_SECURITY_VIOLATION: Invalid role name. Only alphanumeric characters, underscores, and hyphens are allowed. Got: ${role}`);@@ -83,4 +85,3 @@ export const grantSanitizedSchemaAccess = async ({ db, logger, role }: TGrantArgawait db.raw(sql);logger.info(`Granted read access on sanitized schema to role: ${role}`);};-};