From be34c86c475a337dd4179acfd7124d9fa08dff98 Mon Sep 17 00:00:00 2001 From: reaper Date: Wed, 12 Nov 2025 15:12:51 +0530 Subject: [PATCH] fix: replace regex with replaceAll for secure string replace --- packages/bruno-common/src/utils/template-hasher.ts | 2 +- packages/bruno-common/tsconfig.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bruno-common/src/utils/template-hasher.ts b/packages/bruno-common/src/utils/template-hasher.ts index b7b5b0218..c42f9b5d8 100644 --- a/packages/bruno-common/src/utils/template-hasher.ts +++ b/packages/bruno-common/src/utils/template-hasher.ts @@ -41,7 +41,7 @@ export function patternHasher(input: string, pattern: string | RegExp = VARIABLE let clone = current; for (const hash in hashToOriginal) { const value = hashToOriginal[hash]; - clone = clone.replace(new RegExp(`(${hash})`, 'g'), value); + clone = clone.replaceAll(hash, value); } return clone; } diff --git a/packages/bruno-common/tsconfig.json b/packages/bruno-common/tsconfig.json index 9978d57dc..eaf475373 100644 --- a/packages/bruno-common/tsconfig.json +++ b/packages/bruno-common/tsconfig.json @@ -3,6 +3,7 @@ "target": "ES6", "esModuleInterop": true, "strict": true, + "lib": ["es2021"], "skipLibCheck": true, "jsx": "react", "module": "ESNext",