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
misc: moved regex use to re2
Sheen Capadnganc15a1c6ed317
diff --git a/backend/package-lock.json b/backend/package-lock.jsonindex 3cd03cd6e3..be6137424f 100644--- a/backend/package-lock.json+++ b/backend/package-lock.json@@ -104,6 +104,7 @@"pkijs": "^3.2.4","posthog-node": "^3.6.2","probot": "^13.3.8",+ "re2": "^1.21.4","safe-regex": "^2.1.1","scim-patch": "^0.8.3","scim2-parse-filter": "^0.2.10",@@ -6860,6 +6861,79 @@"node": ">= 8"}},+ "node_modules/@npmcli/agent": {+ "version": "2.2.2",+ "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-2.2.2.tgz",+ "integrity": "sha512-OrcNPXdpSl9UX7qPVRWbmWMCSXrcDa2M9DvrbOTj7ao1S4PlqVFYv9/yLKMkrJKZ/V5A/kDBC690or307i26Og==",+ "license": "ISC",+ "dependencies": {+ "agent-base": "^7.1.0",+ "http-proxy-agent": "^7.0.0",+ "https-proxy-agent": "^7.0.1",+ "lru-cache": "^10.0.1",+ "socks-proxy-agent": "^8.0.3"+ },+ "engines": {+ "node": "^16.14.0 || >=18.0.0"+ }+ },+ "node_modules/@npmcli/agent/node_modules/agent-base": {+ "version": "7.1.3",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",+ "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",+ "license": "MIT",+ "engines": {+ "node": ">= 14"+ }+ },+ "node_modules/@npmcli/agent/node_modules/debug": {+ "version": "4.4.0",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",+ "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/@npmcli/agent/node_modules/https-proxy-agent": {+ "version": "7.0.6",+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",+ "license": "MIT",+ "dependencies": {+ "agent-base": "^7.1.2",+ "debug": "4"+ },+ "engines": {+ "node": ">= 14"+ }+ },+ "node_modules/@npmcli/agent/node_modules/lru-cache": {+ "version": "10.4.3",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",+ "license": "ISC"+ },+ "node_modules/@npmcli/fs": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.1.tgz",+ "integrity": "sha512-q9CRWjpHCMIh5sVyefoD1cA7PkvILqCZsnSOEUUivORLjxCO/Irmue2DprETiNgEqktDBZaM1Bi+jrarx1XdCg==",+ "license": "ISC",+ "dependencies": {+ "semver": "^7.3.5"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },"node_modules/@octokit/auth-app": {"version": "7.1.1","resolved": "https://registry.npmjs.org/@octokit/auth-app/-/auth-app-7.1.1.tgz",@@ -11863,6 +11937,115 @@"node": ">=8"}},+ "node_modules/cacache": {+ "version": "18.0.4",+ "resolved": "https://registry.npmjs.org/cacache/-/cacache-18.0.4.tgz",+ "integrity": "sha512-B+L5iIa9mgcjLbliir2th36yEwPftrzteHYujzsx3dFP/31GCHcIeS8f5MGd80odLOjaOvSpU3EEAmRQptkxLQ==",+ "license": "ISC",+ "dependencies": {+ "@npmcli/fs": "^3.1.0",+ "fs-minipass": "^3.0.0",+ "glob": "^10.2.2",+ "lru-cache": "^10.0.1",+ "minipass": "^7.0.3",+ "minipass-collect": "^2.0.1",+ "minipass-flush": "^1.0.5",+ "minipass-pipeline": "^1.2.4",+ "p-map": "^4.0.0",+ "ssri": "^10.0.0",+ "tar": "^6.1.11",+ "unique-filename": "^3.0.0"+ },+ "engines": {+ "node": "^16.14.0 || >=18.0.0"+ }+ },+ "node_modules/cacache/node_modules/brace-expansion": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/cacache/node_modules/fs-minipass": {+ "version": "3.0.3",+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz",+ "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==",+ "license": "ISC",+ "dependencies": {+ "minipass": "^7.0.3"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },+ "node_modules/cacache/node_modules/glob": {+ "version": "10.4.5",+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",+ "license": "ISC",+ "dependencies": {+ "foreground-child": "^3.1.0",+ "jackspeak": "^3.1.2",+ "minimatch": "^9.0.4",+ "minipass": "^7.1.2",+ "package-json-from-dist": "^1.0.0",+ "path-scurry": "^1.11.1"+ },+ "bin": {+ "glob": "dist/esm/bin.mjs"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/cacache/node_modules/jackspeak": {+ "version": "3.4.3",+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "@isaacs/cliui": "^8.0.2"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ },+ "optionalDependencies": {+ "@pkgjs/parseargs": "^0.11.0"+ }+ },+ "node_modules/cacache/node_modules/lru-cache": {+ "version": "10.4.3",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",+ "license": "ISC"+ },+ "node_modules/cacache/node_modules/minimatch": {+ "version": "9.0.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.1"+ },+ "engines": {+ "node": ">=16 || 14 >=14.17"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/cacache/node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },"node_modules/call-bind": {"version": "1.0.7","resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz",@@ -12842,6 +13025,16 @@"node": ">= 0.8"}},+ "node_modules/encoding": {+ "version": "0.1.13",+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",+ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",+ "license": "MIT",+ "optional": true,+ "dependencies": {+ "iconv-lite": "^0.6.2"+ }+ },"node_modules/end-of-stream": {"version": "1.4.4","resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",@@ -12874,6 +13067,21 @@"url": "https://github.com/fb55/entities?sponsor=1"}},+ "node_modules/env-paths": {+ "version": "2.2.1",+ "resolved": "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz",+ "integrity": "sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/err-code": {+ "version": "2.0.3",+ "resolved": "https://registry.npmjs.org/err-code/-/err-code-2.0.3.tgz",+ "integrity": "sha512-2bmlRpNKBxT/CRmPOlyISQpNj+qSeYvcym/uT0Jx2bMOlKLtSy1ZmLuVxSEKKyor/N5yhvp/ZiG1oE3DEYMSFA==",+ "license": "MIT"+ },"node_modules/error-ex": {"version": "1.3.2","resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz",@@ -13644,6 +13852,12 @@"node": ">=0.10.0"}},+ "node_modules/exponential-backoff": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.2.tgz",+ "integrity": "sha512-8QxYTVXUkuy7fIIoitQkPwGonB8F3Zj8eEO8Sqg9Zv/bkI7RJAzowee4gr81Hak/dUTpA2Z7VfQgoijjPNlUZA==",+ "license": "Apache-2.0"+ },"node_modules/express": {"version": "4.21.2","resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz",@@ -15221,6 +15435,12 @@],"license": "MIT"},+ "node_modules/http-cache-semantics": {+ "version": "4.1.1",+ "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz",+ "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==",+ "license": "BSD-2-Clause"+ },"node_modules/http-errors": {"version": "2.0.0","resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",@@ -15403,7 +15623,6 @@"version": "0.1.4","resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz","integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",- "dev": true,"engines": {"node": ">=0.8.19"}@@ -15436,6 +15655,16 @@"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==","dev": true},+ "node_modules/install-artifact-from-github": {+ "version": "1.3.5",+ "resolved": "https://registry.npmjs.org/install-artifact-from-github/-/install-artifact-from-github-1.3.5.tgz",+ "integrity": "sha512-gZHC7f/cJgXz7MXlHFBxPVMsvIbev1OQN1uKQYKVJDydGNm9oYf9JstbU4Atnh/eSvk41WtEovoRm+8IF686xg==",+ "license": "BSD-3-Clause",+ "bin": {+ "install-from-cache": "bin/install-from-cache.js",+ "save-to-github-cache": "bin/save-to-github-cache.js"+ }+ },"node_modules/internal-slot": {"version": "1.0.6","resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.6.tgz",@@ -15518,6 +15747,19 @@"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz","integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="},+ "node_modules/ip-address": {+ "version": "9.0.5",+ "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz",+ "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==",+ "license": "MIT",+ "dependencies": {+ "jsbn": "1.1.0",+ "sprintf-js": "^1.1.3"+ },+ "engines": {+ "node": ">= 12"+ }+ },"node_modules/ip-num": {"version": "1.5.1","resolved": "https://registry.npmjs.org/ip-num/-/ip-num-1.5.1.tgz",@@ -15717,6 +15959,12 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/is-lambda": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz",+ "integrity": "sha512-z7CMFGNrENq5iFB9Bqo64Xk6Y9sg+epq1myIcdHaGnbMTYOxvzsEtdYqQUylB7LxfkvgrrjP32T6Ywciio9UIQ==",+ "license": "MIT"+ },"node_modules/is-negative-zero": {"version": "2.0.2","resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",@@ -16860,6 +17108,38 @@"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==","dev": true},+ "node_modules/make-fetch-happen": {+ "version": "13.0.1",+ "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-13.0.1.tgz",+ "integrity": "sha512-cKTUFc/rbKUd/9meOvgrpJ2WrNzymt6jfRDdwg5UCnVzv9dTpEj9JS5m3wtziXVCjluIXyL8pcaukYqezIzZQA==",+ "license": "ISC",+ "dependencies": {+ "@npmcli/agent": "^2.0.0",+ "cacache": "^18.0.0",+ "http-cache-semantics": "^4.1.1",+ "is-lambda": "^1.0.1",+ "minipass": "^7.0.2",+ "minipass-fetch": "^3.0.0",+ "minipass-flush": "^1.0.5",+ "minipass-pipeline": "^1.2.4",+ "negotiator": "^0.6.3",+ "proc-log": "^4.2.0",+ "promise-retry": "^2.0.1",+ "ssri": "^10.0.0"+ },+ "engines": {+ "node": "^16.14.0 || >=18.0.0"+ }+ },+ "node_modules/make-fetch-happen/node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },"node_modules/math-intrinsics": {"version": "1.1.0","resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",@@ -17033,6 +17313,125 @@"node": ">=8"}},+ "node_modules/minipass-collect": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/minipass-collect/-/minipass-collect-2.0.1.tgz",+ "integrity": "sha512-D7V8PO9oaz7PWGLbCACuI1qEOsq7UKfLotx/C0Aet43fCUB/wfQ7DYeq2oR/svFJGYDHPr38SHATeaj/ZoKHKw==",+ "license": "ISC",+ "dependencies": {+ "minipass": "^7.0.3"+ },+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/minipass-collect/node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/minipass-fetch": {+ "version": "3.0.5",+ "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.5.tgz",+ "integrity": "sha512-2N8elDQAtSnFV0Dk7gt15KHsS0Fyz6CbYZ360h0WTYV1Ty46li3rAXVOQj1THMNLdmrD9Vt5pBPtWtVkpwGBqg==",+ "license": "MIT",+ "dependencies": {+ "minipass": "^7.0.3",+ "minipass-sized": "^1.0.3",+ "minizlib": "^2.1.2"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ },+ "optionalDependencies": {+ "encoding": "^0.1.13"+ }+ },+ "node_modules/minipass-fetch/node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/minipass-flush": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz",+ "integrity": "sha512-JmQSYYpPUqX5Jyn1mXaRwOda1uQ8HP5KAT/oDSLCzt1BYRhQU0/hDtsB1ufZfEEzMZ9aAVmsBw8+FWsIXlClWw==",+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">= 8"+ }+ },+ "node_modules/minipass-flush/node_modules/minipass": {+ "version": "3.3.6",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",+ "license": "ISC",+ "dependencies": {+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minipass-pipeline": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz",+ "integrity": "sha512-xuIq7cIOt09RPRJ19gdi4b+RiNvDFYe5JH+ggNvBqGqpQXcru3PcRmOZuHBKWK1Txf9+cQ+HMVN4d6z46LZP7A==",+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minipass-pipeline/node_modules/minipass": {+ "version": "3.3.6",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",+ "license": "ISC",+ "dependencies": {+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minipass-sized": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz",+ "integrity": "sha512-MbkQQ2CTiBMlA2Dm/5cY+9SWFEN8pzzOXi6rlM5Xxq0Yqbda5ZQy9sU75a673FE9ZK0Zsbr6Y5iP6u9nktfg2g==",+ "license": "ISC",+ "dependencies": {+ "minipass": "^3.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/minipass-sized/node_modules/minipass": {+ "version": "3.3.6",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",+ "license": "ISC",+ "dependencies": {+ "yallist": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },"node_modules/minizlib": {"version": "2.1.2","resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",@@ -17354,6 +17753,12 @@"node": ">=12"}},+ "node_modules/nan": {+ "version": "2.22.2",+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.2.tgz",+ "integrity": "sha512-DANghxFkS1plDdRsX0X9pm0Z6SJNN6gBdtXfanwoZ8hooC5gosGFSBGRYHUVPz1asKA/kMRqDRdHrluZ61SpBQ==",+ "license": "MIT"+ },"node_modules/nanoid": {"version": "3.3.8","resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",@@ -17444,6 +17849,30 @@}}},+ "node_modules/node-gyp": {+ "version": "10.3.1",+ "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-10.3.1.tgz",+ "integrity": "sha512-Pp3nFHBThHzVtNY7U6JfPjvT/DTE8+o/4xKsLQtBoU+j2HLsGlhcfzflAoUreaJbNmYnX+LlLi0qjV8kpyO6xQ==",+ "license": "MIT",+ "dependencies": {+ "env-paths": "^2.2.0",+ "exponential-backoff": "^3.1.1",+ "glob": "^10.3.10",+ "graceful-fs": "^4.2.6",+ "make-fetch-happen": "^13.0.0",+ "nopt": "^7.0.0",+ "proc-log": "^4.1.0",+ "semver": "^7.3.5",+ "tar": "^6.2.1",+ "which": "^4.0.0"+ },+ "bin": {+ "node-gyp": "bin/node-gyp.js"+ },+ "engines": {+ "node": "^16.14.0 || >=18.0.0"+ }+ },"node_modules/node-gyp-build": {"version": "3.9.0","resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.9.0.tgz",@@ -17465,6 +17894,122 @@"node-gyp-build-optional-packages-test": "build-test.js"}},+ "node_modules/node-gyp/node_modules/abbrev": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz",+ "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==",+ "license": "ISC",+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },+ "node_modules/node-gyp/node_modules/brace-expansion": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz",+ "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==",+ "license": "MIT",+ "dependencies": {+ "balanced-match": "^1.0.0"+ }+ },+ "node_modules/node-gyp/node_modules/glob": {+ "version": "10.4.5",+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz",+ "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==",+ "license": "ISC",+ "dependencies": {+ "foreground-child": "^3.1.0",+ "jackspeak": "^3.1.2",+ "minimatch": "^9.0.4",+ "minipass": "^7.1.2",+ "package-json-from-dist": "^1.0.0",+ "path-scurry": "^1.11.1"+ },+ "bin": {+ "glob": "dist/esm/bin.mjs"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/node-gyp/node_modules/isexe": {+ "version": "3.1.1",+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz",+ "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==",+ "license": "ISC",+ "engines": {+ "node": ">=16"+ }+ },+ "node_modules/node-gyp/node_modules/jackspeak": {+ "version": "3.4.3",+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",+ "license": "BlueOak-1.0.0",+ "dependencies": {+ "@isaacs/cliui": "^8.0.2"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ },+ "optionalDependencies": {+ "@pkgjs/parseargs": "^0.11.0"+ }+ },+ "node_modules/node-gyp/node_modules/minimatch": {+ "version": "9.0.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",+ "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",+ "license": "ISC",+ "dependencies": {+ "brace-expansion": "^2.0.1"+ },+ "engines": {+ "node": ">=16 || 14 >=14.17"+ },+ "funding": {+ "url": "https://github.com/sponsors/isaacs"+ }+ },+ "node_modules/node-gyp/node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },+ "node_modules/node-gyp/node_modules/nopt": {+ "version": "7.2.1",+ "resolved": "https://registry.npmjs.org/nopt/-/nopt-7.2.1.tgz",+ "integrity": "sha512-taM24ViiimT/XntxbPyJQzCG+p4EKOpgD3mxFwW38mGjVUrfERQOeY4EDHjdnptttfHuHQXFx+lTP08Q+mLa/w==",+ "license": "ISC",+ "dependencies": {+ "abbrev": "^2.0.0"+ },+ "bin": {+ "nopt": "bin/nopt.js"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },+ "node_modules/node-gyp/node_modules/which": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz",+ "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==",+ "license": "ISC",+ "dependencies": {+ "isexe": "^3.1.1"+ },+ "bin": {+ "node-which": "bin/which.js"+ },+ "engines": {+ "node": "^16.13.0 || >=18.0.0"+ }+ },"node_modules/node-releases": {"version": "2.0.14","resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz",@@ -18125,6 +18670,21 @@"url": "https://github.com/sponsors/sindresorhus"}},+ "node_modules/p-map": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz",+ "integrity": "sha512-/bjOqmgETBYB5BoEeGVea8dmvHb2m9GLy1E9W43yeyfP6QQCZGFNa+XRceJEuDB6zqr+gKpIAmlLebMpykw/MQ==",+ "license": "MIT",+ "dependencies": {+ "aggregate-error": "^3.0.0"+ },+ "engines": {+ "node": ">=10"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },"node_modules/p-queue": {"version": "6.6.2","resolved": "https://registry.npmjs.org/p-queue/-/p-queue-6.6.2.tgz",@@ -19202,6 +19762,15 @@"real-require": "^0.2.0"}},+ "node_modules/proc-log": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-4.2.0.tgz",+ "integrity": "sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==",+ "license": "ISC",+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },"node_modules/process": {"version": "0.11.10","resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",@@ -19230,6 +19799,28 @@"node": ">=0.4.0"}},+ "node_modules/promise-retry": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz",+ "integrity": "sha512-y+WKFlBR8BGXnsNlIHFGPZmyDf3DFMoLhaflAnyZgV6rG6xu+JwesTo2Q9R6XwYmtmwAFCkAk3e35jEdoeh/3g==",+ "license": "MIT",+ "dependencies": {+ "err-code": "^2.0.2",+ "retry": "^0.12.0"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/promise-retry/node_modules/retry": {+ "version": "0.12.0",+ "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz",+ "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==",+ "license": "MIT",+ "engines": {+ "node": ">= 4"+ }+ },"node_modules/prompt-sync": {"version": "4.2.0","resolved": "https://registry.npmjs.org/prompt-sync/-/prompt-sync-4.2.0.tgz",@@ -19501,6 +20092,18 @@"node": ">=0.10.0"}},+ "node_modules/re2": {+ "version": "1.21.4",+ "resolved": "https://registry.npmjs.org/re2/-/re2-1.21.4.tgz",+ "integrity": "sha512-MVIfXWJmsP28mRsSt8HeL750ifb8H5+oF2UDIxGaiJCr8fkMqhLZ7kcX9ADRk2dC8qeGKedB7UVYRfBVpEiLfA==",+ "hasInstallScript": true,+ "license": "BSD-3-Clause",+ "dependencies": {+ "install-artifact-from-github": "^1.3.5",+ "nan": "^2.20.0",+ "node-gyp": "^10.2.0"+ }+ },"node_modules/react-is": {"version": "18.2.0","resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz",@@ -20422,6 +21025,16 @@"node": ">=8"}},+ "node_modules/smart-buffer": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",+ "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",+ "license": "MIT",+ "engines": {+ "node": ">= 6.0.0",+ "npm": ">= 3.0.0"+ }+ },"node_modules/smee-client": {"version": "2.0.0","resolved": "https://registry.npmjs.org/smee-client/-/smee-client-2.0.0.tgz",@@ -20625,6 +21238,60 @@"uuid": "dist/bin/uuid"}},+ "node_modules/socks": {+ "version": "2.8.4",+ "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz",+ "integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==",+ "license": "MIT",+ "dependencies": {+ "ip-address": "^9.0.5",+ "smart-buffer": "^4.2.0"+ },+ "engines": {+ "node": ">= 10.0.0",+ "npm": ">= 3.0.0"+ }+ },+ "node_modules/socks-proxy-agent": {+ "version": "8.0.5",+ "resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz",+ "integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==",+ "license": "MIT",+ "dependencies": {+ "agent-base": "^7.1.2",+ "debug": "^4.3.4",+ "socks": "^2.8.3"+ },+ "engines": {+ "node": ">= 14"+ }+ },+ "node_modules/socks-proxy-agent/node_modules/agent-base": {+ "version": "7.1.3",+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",+ "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",+ "license": "MIT",+ "engines": {+ "node": ">= 14"+ }+ },+ "node_modules/socks-proxy-agent/node_modules/debug": {+ "version": "4.4.0",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",+ "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },"node_modules/sonic-boom": {"version": "3.7.0","resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-3.7.0.tgz",@@ -20680,6 +21347,27 @@"node": ">= 0.6"}},+ "node_modules/ssri": {+ "version": "10.0.6",+ "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.6.tgz",+ "integrity": "sha512-MGrFH9Z4NP9Iyhqn16sDtBpRRNJ0Y2hNa6D65h736fVSaPCHr4DM4sWUNvVaSuC+0OBGhwsrydQwmgfg5LncqQ==",+ "license": "ISC",+ "dependencies": {+ "minipass": "^7.0.3"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },+ "node_modules/ssri/node_modules/minipass": {+ "version": "7.1.2",+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",+ "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",+ "license": "ISC",+ "engines": {+ "node": ">=16 || 14 >=14.17"+ }+ },"node_modules/stack-trace": {"version": "0.0.10","resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",@@ -22482,6 +23170,30 @@"node": ">=4"}},+ "node_modules/unique-filename": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz",+ "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==",+ "license": "ISC",+ "dependencies": {+ "unique-slug": "^4.0.0"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },+ "node_modules/unique-slug": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz",+ "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==",+ "license": "ISC",+ "dependencies": {+ "imurmurhash": "^0.1.4"+ },+ "engines": {+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"+ }+ },"node_modules/universal-github-app-jwt": {"version": "2.2.0","resolved": "https://registry.npmjs.org/universal-github-app-jwt/-/universal-github-app-jwt-2.2.0.tgz",diff --git a/backend/package.json b/backend/package.jsonindex 66eddcc107..b2c0d751ab 100644--- a/backend/package.json+++ b/backend/package.json@@ -221,6 +221,7 @@"pkijs": "^3.2.4","posthog-node": "^3.6.2","probot": "^13.3.8",+ "re2": "^1.21.4","safe-regex": "^2.1.1","scim-patch": "^0.8.3","scim2-parse-filter": "^0.2.10",diff --git a/backend/src/ee/services/dynamic-secret/providers/ldap.ts b/backend/src/ee/services/dynamic-secret/providers/ldap.tsindex 992c9098e9..cc68304e01 100644--- a/backend/src/ee/services/dynamic-secret/providers/ldap.ts+++ b/backend/src/ee/services/dynamic-secret/providers/ldap.ts@@ -2,6 +2,7 @@ import handlebars from "handlebars";import ldapjs from "ldapjs";import ldif from "ldif";import { customAlphabet } from "nanoid";+import RE2 from "re2";import { z } from "zod";import { BadRequestError } from "@app/lib/errors";@@ -194,7 +195,8 @@ export const LdapProvider = (): TDynamicProviderFns => {const client = await $getClient(providerInputs);if (providerInputs.credentialType === LdapCredentialType.Static) {- const dnMatch = providerInputs.rotationLdif.match(/^dn:\s*(.+)/m);+ const dnRegex = new RE2("^dn:\\s*(.+)", "m");+ const dnMatch = dnRegex.exec(providerInputs.rotationLdif);if (dnMatch) {const username = dnMatch[1];@@ -238,7 +240,8 @@ export const LdapProvider = (): TDynamicProviderFns => {const client = await $getClient(providerInputs);if (providerInputs.credentialType === LdapCredentialType.Static) {- const dnMatch = providerInputs.rotationLdif.match(/^dn:\s*(.+)/m);+ const dnRegex = new RE2("^dn:\\s*(.+)", "m");+ const dnMatch = dnRegex.exec(providerInputs.rotationLdif);if (dnMatch) {const username = dnMatch[1];diff --git a/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts b/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.tsindex 48d7939707..a09cc55ff4 100644--- a/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts+++ b/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts@@ -1,4 +1,5 @@import { isIP } from "net";+import RE2 from "re2";import { isFQDN } from "@app/lib/validator/validate-url";@@ -10,7 +11,7 @@ export const isValidUserPattern = (value: string): boolean => {if (value === "*") return true; // Handle wildcard separately// Simpler, more specific pattern for usernames- const userRegex = /^[a-z_][a-z0-9_-]*$/i;+ const userRegex = new RE2(/^[a-z_][a-z0-9_-]*$/i);return userRegex.test(value);};diff --git a/backend/src/ee/services/ssh/ssh-certificate-authority-fns.ts b/backend/src/ee/services/ssh/ssh-certificate-authority-fns.tsindex 92f9467471..60c966fcde 100644--- a/backend/src/ee/services/ssh/ssh-certificate-authority-fns.ts+++ b/backend/src/ee/services/ssh/ssh-certificate-authority-fns.ts@@ -4,6 +4,7 @@ import { promises as fs } from "fs";import { Knex } from "knex";import os from "os";import path from "path";+import RE2 from "re2";import { promisify } from "util";import { TSshCertificateTemplates } from "@app/db/schemas";@@ -156,14 +157,14 @@ export const validateSshCertificatePrincipals = (});}- if (/\r|\n|\t|\0/.test(sanitized)) {+ if (new RE2(/\r|\n|\t|\0/).test(sanitized)) {throw new BadRequestError({message: `Principal '${sanitized}' contains invalid whitespace or control characters.`});}// disallow whitespace anywhere- if (/\s/.test(sanitized)) {+ if (new RE2(/\s/).test(sanitized)) {throw new BadRequestError({message: `Principal '${sanitized}' cannot contain whitespace.`});diff --git a/backend/src/lib/base64/index.ts b/backend/src/lib/base64/index.tsindex 2bffef3fc8..dfdd03d474 100644--- a/backend/src/lib/base64/index.ts+++ b/backend/src/lib/base64/index.ts@@ -1,12 +1,16 @@+import RE2 from "re2";+type Base64Options = {urlSafe?: boolean;padding?: boolean;};-const base64WithPadding = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/;-const base64WithoutPadding = /^[A-Za-z0-9+/]+$/;-const base64UrlWithPadding = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}==|[A-Za-z0-9_-]{3}=|[A-Za-z0-9_-]{4})$/;-const base64UrlWithoutPadding = /^[A-Za-z0-9_-]+$/;+const base64WithPadding = new RE2(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/);+const base64WithoutPadding = new RE2(/^[A-Za-z0-9+/]+$/);+const base64UrlWithPadding = new RE2(+ /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}==|[A-Za-z0-9_-]{3}=|[A-Za-z0-9_-]{4})$/+);+const base64UrlWithoutPadding = new RE2(/^[A-Za-z0-9_-]+$/);export const isBase64 = (str: string, options: Base64Options = {}): boolean => {if (typeof str !== "string") {diff --git a/backend/src/lib/fn/string.ts b/backend/src/lib/fn/string.tsindex 1dc2bbfed0..2fa4c91667 100644--- a/backend/src/lib/fn/string.ts+++ b/backend/src/lib/fn/string.ts@@ -1,4 +1,5 @@import path from "path";+import RE2 from "re2";// given two paths irrespective of ending with / or not// this will return true if its equal@@ -15,4 +16,6 @@ export const prefixWithSlash = (str: string) => {return `/${str}`;};-export const startsWithVowel = (str: string) => /^[aeiou]/i.test(str);+const vowelRegex = new RE2(/^[aeiou]/i);++export const startsWithVowel = (str: string) => vowelRegex.test(str);diff --git a/backend/src/lib/validator/validate-string.ts b/backend/src/lib/validator/validate-string.tsindex d2d0336939..4e89d313fb 100644--- a/backend/src/lib/validator/validate-string.ts+++ b/backend/src/lib/validator/validate-string.ts@@ -1,3 +1,4 @@+import RE2 from "re2";import { z } from "zod";export enum CharacterType {@@ -92,7 +93,7 @@ export const characterValidator = (allowedCharacters: CharacterType[]) => {const combinedPattern = allowedCharacters.map((char) => patternMap[char]).join("");// Create a regex that matches only the allowed characters- const regex = new RegExp(`^[${combinedPattern}]+$`);+ const regex = new RE2(`^[${combinedPattern}]+$`);/*** Validates if the input string contains only the allowed character typesdiff --git a/backend/src/lib/validator/validate-url.ts b/backend/src/lib/validator/validate-url.tsindex fdf99e4057..6a8fa4941c 100644--- a/backend/src/lib/validator/validate-url.ts+++ b/backend/src/lib/validator/validate-url.ts@@ -1,6 +1,7 @@import dns from "node:dns/promises";import { isIPv4 } from "net";+import RE2 from "re2";import { getConfig } from "@app/lib/config/env";@@ -80,42 +81,47 @@ export const isFQDN = (str: string, options: FQDNOptions = {}): boolean => {if (!opts.allow_numeric_tld &&- !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)+ !new RE2(/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i).test(tld)) {return false;}// disallow spaces- if (/\s/.test(tld)) {+ if (new RE2(/\s/).test(tld)) {return false;}}// reject numeric TLDs- if (!opts.allow_numeric_tld && /^\d+$/.test(tld)) {+ if (!opts.allow_numeric_tld && new RE2(/^\d+$/).test(tld)) {return false;}+ const partRegex = new RE2(/^[a-z_\u00a1-\uffff0-9-]+$/i);+ const fullWidthRegex = new RE2(/[\uff01-\uff5e]/);+ const hyphenRegex = new RE2(/^-|-$/);+ const underscoreRegex = new RE2("_");+return parts.every((part) => {if (part.length > 63 && !opts.ignore_max_length) {return false;}- if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) {+ if (!partRegex.test(part)) {return false;}// disallow full-width chars- if (/[\uff01-\uff5e]/.test(part)) {+ if (fullWidthRegex.test(part)) {return false;}// disallow parts starting or ending with hyphen- if (/^-|-$/.test(part)) {+ if (hyphenRegex.test(part)) {return false;}- if (!opts.allow_underscores && /_/.test(part)) {+ if (!opts.allow_underscores && underscoreRegex.test(part)) {return false;}diff --git a/backend/src/lib/zod/index.ts b/backend/src/lib/zod/index.tsindex 4d3fea8c7b..21c59b6ba2 100644--- a/backend/src/lib/zod/index.ts+++ b/backend/src/lib/zod/index.ts@@ -1,3 +1,4 @@+import RE2 from "re2";import { z, ZodTypeAny } from "zod";// this is a patched zod string to remove empty string to undefined@@ -11,3 +12,8 @@ export const zpStr = <T extends ZodTypeAny>(schema: T, opt: { stripNull: booleanexport const zodBuffer = z.custom<Buffer>((data) => Buffer.isBuffer(data) || data instanceof Uint8Array, {message: "Expected binary data (Buffer Or Uint8Array)"});++export const re2Validator = (pattern: string | RegExp) => {+ const re2Pattern = new RE2(pattern);+ return (value: string) => re2Pattern.test(value);+};diff --git a/backend/src/server/routes/v1/project-router.ts b/backend/src/server/routes/v1/project-router.tsindex 4182ce3895..407bdef1f4 100644--- a/backend/src/server/routes/v1/project-router.ts+++ b/backend/src/server/routes/v1/project-router.ts@@ -15,6 +15,7 @@ import {import { EventType } from "@app/ee/services/audit-log/audit-log-types";import { PROJECTS } from "@app/lib/api-docs";import { CharacterType, characterValidator } from "@app/lib/validator/validate-string";+import { re2Validator } from "@app/lib/zod";import { readLimit, writeLimit } from "@app/server/config/rateLimiter";import { verifyAuth } from "@app/server/plugins/auth/verify-auth";import { ActorType, AuthMode } from "@app/services/auth/auth-type";@@ -316,11 +317,11 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {slug: z.string().trim()- .regex(- /^[a-z0-9]+(?:[_-][a-z0-9]+)*$/,- "Project slug can only contain lowercase letters and numbers, with optional single hyphens (-) or underscores (_) between words. Cannot start or end with a hyphen or underscore."- ).max(64, { message: "Slug must be 64 characters or fewer" })+ .refine(re2Validator(/^[a-z0-9]+(?:[_-][a-z0-9]+)*$/), {+ message:+ "Project slug can only contain lowercase letters and numbers, with optional single hyphens (-) or underscores (_) between words. Cannot start or end with a hyphen or underscore."+ }).optional().describe(PROJECTS.UPDATE.slug)}),diff --git a/backend/src/services/certificate-template/certificate-template-fns.ts b/backend/src/services/certificate-template/certificate-template-fns.tsindex fa8055f691..b6ec8d7555 100644--- a/backend/src/services/certificate-template/certificate-template-fns.ts+++ b/backend/src/services/certificate-template/certificate-template-fns.ts@@ -1,3 +1,5 @@+import RE2 from "re2";+import { TCertificateTemplates } from "@app/db/schemas";import { BadRequestError } from "@app/lib/errors";import { ms } from "@app/lib/ms";@@ -12,7 +14,7 @@ export const validateCertificateDetailsAgainstTemplate = (template: TCertificateTemplates) => {// these are validated in router using validateTemplateRegexField- const commonNameRegex = new RegExp(template.commonName);+ const commonNameRegex = new RE2(template.commonName);if (!commonNameRegex.test(cert.commonName)) {throw new BadRequestError({message: "Invalid common name based on template policy"@@ -25,7 +27,7 @@ export const validateCertificateDetailsAgainstTemplate = (});}- const subjectAlternativeNameRegex = new RegExp(template.subjectAlternativeName);+ const subjectAlternativeNameRegex = new RE2(template.subjectAlternativeName);cert.altNames.forEach((altName) => {if (!subjectAlternativeNameRegex.test(altName)) {throw new BadRequestError({diff --git a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts b/backend/src/services/identity-aws-auth/identity-aws-auth-service.tsindex 7f0aadfcae..68989893f2 100644--- a/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts+++ b/backend/src/services/identity-aws-auth/identity-aws-auth-service.ts@@ -2,6 +2,7 @@import { ForbiddenError } from "@casl/ability";import axios from "axios";import jwt from "jsonwebtoken";+import RE2 from "re2";import { IdentityAuthMethod } from "@app/db/schemas";import { TLicenseServiceFactory } from "@app/ee/services/license/license-service";@@ -125,7 +126,7 @@ export const identityAwsAuthServiceFactory = ({// convert wildcard ARN to a regular expression: "arn:aws:iam::123456789012:*" -> "^arn:aws:iam::123456789012:.*$"// considers exact matches + wildcard matches// heavily validated in router- const regex = new RegExp(`^${principalArn.replaceAll("*", ".*")}$`);+ const regex = new RE2(`^${principalArn.replaceAll("*", ".*")}$`);return regex.test(extractPrincipalArn(Arn));});diff --git a/backend/src/services/identity-aws-auth/identity-aws-auth-validators.ts b/backend/src/services/identity-aws-auth/identity-aws-auth-validators.tsindex b3f3ccc94b..1a6e5cbd69 100644--- a/backend/src/services/identity-aws-auth/identity-aws-auth-validators.ts+++ b/backend/src/services/identity-aws-auth/identity-aws-auth-validators.ts@@ -1,9 +1,10 @@+import RE2 from "re2";import safe from "safe-regex";import { z } from "zod";-const twelveDigitRegex = /^\d{12}$/;+const twelveDigitRegex = new RE2(/^\d{12}$/);// akhilmhdh: change this to a normal function later. Checked no redosable at the moment-const arnRegex = /^arn:aws:iam::\d{12}:(user\/[a-zA-Z0-9_.@+*/-]+|role\/[a-zA-Z0-9_.@+*/-]+|\*)$/;+const arnRegex = new RE2(/^arn:aws:iam::\d{12}:(user\/[a-zA-Z0-9_.@+*/-]+|role\/[a-zA-Z0-9_.@+*/-]+|\*)$/);export const validateAccountIds = z.string()diff --git a/backend/src/services/integration-auth/integration-sync-secret.ts b/backend/src/services/integration-auth/integration-sync-secret.tsindex 6be7397f3b..989a5a88ca 100644--- a/backend/src/services/integration-auth/integration-sync-secret.ts+++ b/backend/src/services/integration-auth/integration-sync-secret.ts@@ -27,6 +27,7 @@ import { randomUUID } from "crypto";import https from "https";import sodium from "libsodium-wrappers";import isEqual from "lodash.isequal";+import RE2 from "re2";import { z } from "zod";import { SecretType, TIntegrationAuths, TIntegrations } from "@app/db/schemas";@@ -4151,7 +4152,7 @@ const syncSecretsWindmill = async ({);// eslint-disable-next-line- const pattern = new RegExp("^(u/|f/)[a-zA-Z0-9_-]+/([a-zA-Z0-9_-]+/)*[a-zA-Z0-9_-]*[^/]$");+ const pattern = new RE2("^(u/|f/)[a-zA-Z0-9_-]+/([a-zA-Z0-9_-]+/)*[a-zA-Z0-9_-]*[^/]$");for await (const key of Object.keys(secrets)) {if ((key.startsWith("u/") || key.startsWith("f/")) && pattern.test(key)) {if (!(key in res)) {diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.tsindex 3b35ab41a2..4e7a5bca75 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts@@ -1,5 +1,7 @@import path from "node:path";+import RE2 from "re2";+import { TableName, TSecretFolders, TSecretsV2 } from "@app/db/schemas";import { ForbiddenRequestError, NotFoundError } from "@app/lib/errors";import { groupBy } from "@app/lib/fn";@@ -13,9 +15,8 @@ import { TSecretFolderDALFactory } from "../secret-folder/secret-folder-dal";import { TSecretV2BridgeDALFactory } from "./secret-v2-bridge-dal";import { TFnSecretBulkDelete, TFnSecretBulkInsert, TFnSecretBulkUpdate } from "./secret-v2-bridge-types";-const INTERPOLATION_SYNTAX_REG = /\${([a-zA-Z0-9-_.]+)}/g;-// akhilmhdh: JS regex with global save state in .test-const INTERPOLATION_SYNTAX_REG_NON_GLOBAL = /\${([a-zA-Z0-9-_.]+)}/;+const INTERPOLATION_PATTERN_STRING = String.raw`\${([a-zA-Z0-9-_.]+)}`;+const INTERPOLATION_TEST_REGEX = new RE2(INTERPOLATION_PATTERN_STRING);export const shouldUseSecretV2Bridge = (version: number) => version === 3;@@ -36,7 +37,14 @@ export const shouldUseSecretV2Bridge = (version: number) => version === 3;* // ]*/export const getAllSecretReferences = (maybeSecretReference: string) => {- const references = Array.from(maybeSecretReference.matchAll(INTERPOLATION_SYNTAX_REG), (m) => m[1]);+ const references = [];+ let match;++ const regex = new RE2(INTERPOLATION_PATTERN_STRING, "g");+ // eslint-disable-next-line no-cond-assign+ while ((match = regex.exec(maybeSecretReference)) !== null) {+ references.push(match[1]);+ }const nestedReferences = references.filter((el) => el.includes("."))@@ -531,9 +539,17 @@ export const expandSecretReferencesFactory = ({// eslint-disable-next-line no-continueif (depth > MAX_SECRET_REFERENCE_DEPTH) continue;- const refs = value?.match(INTERPOLATION_SYNTAX_REG);- if (refs) {+ const matchRegex = new RE2(INTERPOLATION_PATTERN_STRING, "g");+ const refs = [];+ let match;++ // eslint-disable-next-line no-cond-assign+ while ((match = matchRegex.exec(value || "")) !== null) {+ refs.push(match[0]);+ }++ if (refs.length > 0) {for (const interpolationSyntax of refs) {const interpolationKey = interpolationSyntax.slice(2, interpolationSyntax.length - 1);const entities = interpolationKey.trim().split(".");@@ -592,7 +608,7 @@ export const expandSecretReferencesFactory = ({trace};- const shouldExpandMore = INTERPOLATION_SYNTAX_REG_NON_GLOBAL.test(referencedSecretValue);+ const shouldExpandMore = INTERPOLATION_TEST_REGEX.test(referencedSecretValue);if (dto.shouldStackTrace) {const stackTraceNode = { ...node, children: [], key: referencedSecretKey, trace: null };trace?.children.push(stackTraceNode);@@ -626,7 +642,7 @@ export const expandSecretReferencesFactory = ({}) => {if (!inputSecret.value) return inputSecret.value;- const shouldExpand = Boolean(inputSecret.value?.match(INTERPOLATION_SYNTAX_REG));+ const shouldExpand = INTERPOLATION_TEST_REGEX.test(inputSecret.value);if (!shouldExpand) return inputSecret.value;const { expandedValue } = await recursivelyExpandSecret(inputSecret);diff --git a/backend/src/services/secret/secret-fns.ts b/backend/src/services/secret/secret-fns.tsindex 2574dc13ec..f08a5a04c7 100644--- a/backend/src/services/secret/secret-fns.ts+++ b/backend/src/services/secret/secret-fns.ts@@ -1,5 +1,6 @@/* eslint-disable no-await-in-loop */import path from "path";+import RE2 from "re2";import {ActionProjectType,@@ -218,7 +219,9 @@ type TInterpolateSecretArg = {};const MAX_SECRET_REFERENCE_DEPTH = 5;-const INTERPOLATION_SYNTAX_REG = /\${([a-zA-Z0-9-_.]+)}/g;+const INTERPOLATION_PATTERN_STRING = String.raw`\${([a-zA-Z0-9-_.]+)}`;+const INTERPOLATION_TEST_REGEX = new RE2(INTERPOLATION_PATTERN_STRING);+export const interpolateSecrets = ({ projectId, secretEncKey, secretDAL, folderDAL }: TInterpolateSecretArg) => {const secretCache: Record<string, Record<string, string>> = {};const getCacheUniqueKey = (environment: string, secretPath: string) => `${environment}-${secretPath}`;@@ -273,9 +276,17 @@ export const interpolateSecrets = ({ projectId, secretEncKey, secretDAL, folderDif (!value) return "";if (depth > MAX_SECRET_REFERENCE_DEPTH) return "";- const refs = value.match(INTERPOLATION_SYNTAX_REG);+ const refs = [];+ let match;+ const execRegex = new RE2(INTERPOLATION_PATTERN_STRING, "g");++ // eslint-disable-next-line no-cond-assign+ while ((match = execRegex.exec(value)) !== null) {+ refs.push(match[0]);+ }+let expandedValue = value;- if (refs) {+ if (refs.length > 0) {for (const interpolationSyntax of refs) {const interpolationKey = interpolationSyntax.slice(2, interpolationSyntax.length - 1);const entities = interpolationKey.trim().split(".");@@ -284,7 +295,7 @@ export const interpolateSecrets = ({ projectId, secretEncKey, secretDAL, folderDconst [secretKey] = entities;// eslint-disable-next-linelet referenceValue = await fetchSecret(environment, secretPath, secretKey);- if (INTERPOLATION_SYNTAX_REG.test(referenceValue)) {+ if (INTERPOLATION_TEST_REGEX.test(referenceValue)) {// eslint-disable-next-linereferenceValue = await recursivelyExpandSecret({environment,@@ -305,7 +316,7 @@ export const interpolateSecrets = ({ projectId, secretEncKey, secretDAL, folderD// eslint-disable-next-linelet referenceValue = await fetchSecret(secretReferenceEnvironment, secretReferencePath, secretReferenceKey);- if (INTERPOLATION_SYNTAX_REG.test(referenceValue)) {+ if (INTERPOLATION_TEST_REGEX.test(referenceValue)) {// eslint-disable-next-linereferenceValue = await recursivelyExpandSecret({environment: secretReferenceEnvironment,@@ -332,7 +343,7 @@ export const interpolateSecrets = ({ projectId, secretEncKey, secretDAL, folderD}) => {if (!inputSecret.value) return inputSecret.value;- const shouldExpand = Boolean(inputSecret.value?.match(INTERPOLATION_SYNTAX_REG));+ const shouldExpand = INTERPOLATION_TEST_REGEX.test(inputSecret.value);if (!shouldExpand) return inputSecret.value;const expandedSecretValue = await recursivelyExpandSecret(inputSecret);@@ -451,7 +462,18 @@ export const fnSecretBlindIndexCheckV2 = async ({* // ]*/export const getAllNestedSecretReferences = (maybeSecretReference: string) => {- const references = Array.from(maybeSecretReference.matchAll(INTERPOLATION_SYNTAX_REG), (m) => m[1]);+ const matches = [];+ let match;++ const execRegex = new RE2(INTERPOLATION_PATTERN_STRING, "g");++ // eslint-disable-next-line no-cond-assign+ while ((match = execRegex.exec(maybeSecretReference)) !== null) {+ matches.push(match);+ }++ const references = matches.map((m) => m[1]);+return references.filter((el) => el.includes(".")).map((el) => {