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
feat(backend): add sanitized schema generation for analytics views ## Context
Maidul Islam31dc897b44a6
diff --git a/backend/package-lock.json b/backend/package-lock.jsonindex 70e9000442..fa094a660d 100644--- a/backend/package-lock.json+++ b/backend/package-lock.json@@ -33,6 +33,7 @@"@fastify/swagger-ui": "^3.1.0","@gitbeaker/rest": "^42.5.0","@google-cloud/kms": "^4.5.0",+ "@infisical/pg-view-generator": "^1.0.0","@infisical/quic": "^1.0.8","@modelcontextprotocol/sdk": "^1.24.3","@node-saml/passport-saml": "^5.1.0",@@ -660,7 +661,6 @@"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.637.0.tgz","integrity": "sha512-xUi7x4qDubtA8QREtlblPuAcn91GS/09YVEY/RwU7xCY0aqGuFwgszAANlha4OUIqva8oVj2WO4gJuG+iaSnhw==","license": "Apache-2.0",- "peer": true,"dependencies": {"@aws-crypto/sha256-browser": "5.2.0","@aws-crypto/sha256-js": "5.2.0",@@ -3229,7 +3229,6 @@"version": "3.632.0","resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.632.0.tgz","integrity": "sha512-Oh1fIWaoZluihOCb/zDEpRTi+6an82fgJz7fyRBugyLhEtDjmvpCQ3oKjzaOhoN+4EvXAm1ZS/ZgpvXBlIRTgw==",- "peer": true,"dependencies": {"@aws-crypto/sha256-browser": "5.2.0","@aws-crypto/sha256-js": "5.2.0",@@ -3306,7 +3305,6 @@"version": "3.632.0","resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.632.0.tgz","integrity": "sha512-Ss5cBH09icpTvT+jtGGuQlRdwtO7RyE9BF4ZV/CEPATdd9whtJt4Qxdya8BUnkWR7h5HHTrQHqai3YVYjku41A==",- "peer": true,"dependencies": {"@aws-crypto/sha256-browser": "5.2.0","@aws-crypto/sha256-js": "5.2.0",@@ -7597,7 +7595,6 @@"integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@ampproject/remapping": "^2.2.0","@babel/code-frame": "^7.26.2",@@ -9629,7 +9626,6 @@"url": "https://opencollective.com/csstools"}],- "peer": true,"engines": {"node": ">=18"},@@ -9651,7 +9647,6 @@"url": "https://opencollective.com/csstools"}],- "peer": true,"engines": {"node": ">=18"}@@ -11451,6 +11446,18 @@"url": "https://opencollective.com/libvips"}},+ "node_modules/@infisical/pg-view-generator": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/@infisical/pg-view-generator/-/pg-view-generator-1.0.0.tgz",+ "integrity": "sha512-PlA5vujGtwx0KFhNqSUB8b9t9bn9ggpWdM2/qkFL85eDx86Mfmr6P76bBdfEHpjbddVO3+n1Ad5QDp/YB+1Nyg==",+ "license": "MIT",+ "dependencies": {+ "js-yaml": "^4.1.0"+ },+ "engines": {+ "node": ">=18.0.0"+ }+ },"node_modules/@infisical/quic": {"version": "1.0.8","resolved": "https://registry.npmjs.org/@infisical/quic/-/quic-1.0.8.tgz",@@ -11557,9 +11564,6 @@"win32"]},- "node_modules/@infisical/quic/node_modules/@infisical/quic-linux-arm": {- "optional": true- },"node_modules/@ioredis/commands": {"version": "1.2.0","resolved": "https://registry.npmjs.org/@ioredis/commands/-/commands-1.2.0.tgz",@@ -12275,7 +12279,6 @@"resolved": "https://registry.npmjs.org/zod/-/zod-4.1.13.tgz","integrity": "sha512-AvvthqfqrAhNH9dnfmrfKzX5upOdjUVJYFqNSlkmGf64gRaTzlPwz99IHYnVs28qYAybvAlBV+H7pn0saFY4Ig==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}@@ -12982,7 +12985,6 @@"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.2.1.tgz","integrity": "sha512-dKYCMuPO1bmrpuogcjQ8z7ICCH3FP6WmxpwC03yjzGfZhj9fTJg6+bS1+UAplekbN2C+M61UNllGOOoAfGCrdQ==","license": "MIT",- "peer": true,"dependencies": {"@octokit/auth-token": "^4.0.0","@octokit/graphql": "^7.1.0",@@ -13426,7 +13428,6 @@"version": "1.9.0","resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz","integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==",- "peer": true,"engines": {"node": ">=8.0.0"}@@ -14081,7 +14082,6 @@"resolved": "https://registry.npmjs.org/@react-email/body/-/body-0.2.0.tgz","integrity": "sha512-9GCWmVmKUAoRfloboCd+RKm6X17xn7eGL7HnpAZUnjBXBilWCxsKnLMTC/ixSHDKS/A/057M1Tx6ZUXd89sVBw==","license": "MIT",- "peer": true,"peerDependencies": {"react": "^18.0 || ^19.0 || ^19.0.0-rc"}@@ -14091,7 +14091,6 @@"resolved": "https://registry.npmjs.org/@react-email/button/-/button-0.2.0.tgz","integrity": "sha512-8i+v6cMxr2emz4ihCrRiYJPp2/sdYsNNsBzXStlcA+/B9Umpm5Jj3WJKYpgTPM+aeyiqlG/MMI1AucnBm4f1oQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14104,7 +14103,6 @@"resolved": "https://registry.npmjs.org/@react-email/code-block/-/code-block-0.2.0.tgz","integrity": "sha512-eIrPW9PIFgDopQU0e/OPpwCW2QWQDtNZDSsiN4sJO8KdMnWWnXJicnRfzrit5rHwFo+Y98i+w/Y5ScnBAFr1dQ==","license": "MIT",- "peer": true,"dependencies": {"prismjs": "^1.30.0"},@@ -14120,7 +14118,6 @@"resolved": "https://registry.npmjs.org/@react-email/code-inline/-/code-inline-0.0.5.tgz","integrity": "sha512-MmAsOzdJpzsnY2cZoPHFPk6uDO/Ncpb4Kh1hAt9UZc1xOW3fIzpe1Pi9y9p6wwUmpaeeDalJxAxH6/fnTquinA==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14196,7 +14193,6 @@"resolved": "https://registry.npmjs.org/@react-email/container/-/container-0.0.15.tgz","integrity": "sha512-Qo2IQo0ru2kZq47REmHW3iXjAQaKu4tpeq/M8m1zHIVwKduL2vYOBQWbC2oDnMtWPmkBjej6XxgtZByxM6cCFg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14230,7 +14226,6 @@"resolved": "https://registry.npmjs.org/@react-email/heading/-/heading-0.0.15.tgz","integrity": "sha512-xF2GqsvBrp/HbRHWEfOgSfRFX+Q8I5KBEIG5+Lv3Vb2R/NYr0s8A5JhHHGf2pWBMJdbP4B2WHgj/VUrhy8dkIg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14243,7 +14238,6 @@"resolved": "https://registry.npmjs.org/@react-email/hr/-/hr-0.0.11.tgz","integrity": "sha512-S1gZHVhwOsd1Iad5IFhpfICwNPMGPJidG/Uysy1AwmspyoAP5a4Iw3OWEpINFdgh9MHladbxcLKO2AJO+cA9Lw==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14268,7 +14262,6 @@"resolved": "https://registry.npmjs.org/@react-email/img/-/img-0.0.11.tgz","integrity": "sha512-aGc8Y6U5C3igoMaqAJKsCpkbm1XjguQ09Acd+YcTKwjnC2+0w3yGUJkjWB2vTx4tN8dCqQCXO8FmdJpMfOA9EQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14281,7 +14274,6 @@"resolved": "https://registry.npmjs.org/@react-email/link/-/link-0.0.12.tgz","integrity": "sha512-vF+xxQk2fGS1CN7UPQDbzvcBGfffr+GjTPNiWM38fhBfsLv6A/YUfaqxWlmL7zLzVmo0K2cvvV9wxlSyNba1aQ==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14309,7 +14301,6 @@"resolved": "https://registry.npmjs.org/@react-email/preview/-/preview-0.0.13.tgz","integrity": "sha512-F7j9FJ0JN/A4d7yr+aw28p4uX7VLWs7hTHtLo7WRyw4G+Lit6Zucq4UWKRxJC8lpsUdzVmG7aBJnKOT+urqs/w==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -14414,7 +14405,6 @@"resolved": "https://registry.npmjs.org/@react-email/text/-/text-0.1.5.tgz","integrity": "sha512-o5PNHFSE085VMXayxH+SJ1LSOtGsTv+RpNKnTiJDrJUwoBu77G3PlKOsZZQHCNyD28WsQpl9v2WcJLbQudqwPg==","license": "MIT",- "peer": true,"engines": {"node": ">=18.0.0"},@@ -16526,7 +16516,6 @@"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.23.tgz","integrity": "sha512-yIdlVVVHXpmqRhtyovZAcSy0MiPcYWGkoO4CGe/+jpP0hmNuihm4XhHbADpK++MsiLHP5MVlv+bcgdF99kSiFQ==","license": "MIT",- "peer": true,"dependencies": {"undici-types": "~6.21.0"}@@ -17015,7 +17004,6 @@"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.20.0.tgz","integrity": "sha512-bYerPDF/H5v6V76MdMYhjwmwgMA+jlPVqjSDq2cRqMi8bP5sR3Z+RLOiOMad3nsnmDVmn2gAFCyNgh/dIrfP/w==","dev": true,- "peer": true,"dependencies": {"@typescript-eslint/scope-manager": "6.20.0","@typescript-eslint/types": "6.20.0",@@ -17474,7 +17462,6 @@"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz","integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==","license": "MIT",- "peer": true,"bin": {"acorn": "bin/acorn"},@@ -17963,7 +17950,6 @@"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz","integrity": "sha512-+I//4cYPccV8LdmBLiX8CYvf9Sp3vQsrqu2QNXRcrbiWvcx/UdlFiqUJJzxRQxgsZmvhXhn4cSKeSmoFjVdupA==","license": "MIT",- "peer": true,"dependencies": {"bn.js": "^4.0.0","inherits": "^2.0.1",@@ -18180,7 +18166,6 @@"resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz","integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==","license": "MIT",- "peer": true,"dependencies": {"follow-redirects": "^1.15.6","form-data": "^4.0.4",@@ -18778,7 +18763,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"baseline-browser-mapping": "^2.8.9","caniuse-lite": "^1.0.30001746",@@ -20192,7 +20176,6 @@"version": "16.4.1","resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz","integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==",- "peer": true,"engines": {"node": ">=12"},@@ -20578,7 +20561,6 @@"dev": true,"hasInstallScript": true,"license": "MIT",- "peer": true,"bin": {"esbuild": "bin/esbuild"},@@ -20661,7 +20643,6 @@"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.56.0.tgz","integrity": "sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==","dev": true,- "peer": true,"dependencies": {"@eslint-community/eslint-utils": "^4.2.0","@eslint-community/regexpp": "^4.6.1",@@ -20760,7 +20741,6 @@"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz","integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==","dev": true,- "peer": true,"bin": {"eslint-config-prettier": "bin/cli.js"},@@ -20849,7 +20829,6 @@"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz","integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==","dev": true,- "peer": true,"dependencies": {"array-includes": "^3.1.7","array.prototype.findlastindex": "^1.2.3",@@ -21261,7 +21240,6 @@"resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz","integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==","license": "MIT",- "peer": true,"dependencies": {"accepts": "~1.3.8","array-flatten": "1.1.1",@@ -21323,6 +21301,7 @@"resolved": "https://registry.npmjs.org/express-session/-/express-session-1.18.1.tgz","integrity": "sha512-a5mtTqEaZvBCL9A9aqkrtfz+3SMDhOVUnjafjo+s7A9Txkq+SVX2DLvSp1Zrv4uCXa3lMSK3viWnh9Gg07PBUA==","license": "MIT",+ "peer": true,"dependencies": {"cookie": "0.7.2","cookie-signature": "1.0.7",@@ -21340,12 +21319,14 @@"node_modules/express-session/node_modules/cookie-signature": {"version": "1.0.7","resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",- "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",+ "peer": true},"node_modules/express-session/node_modules/debug": {"version": "2.6.9","resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz","integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "peer": true,"dependencies": {"ms": "2.0.0"}@@ -21353,7 +21334,8 @@"node_modules/express-session/node_modules/ms": {"version": "2.0.0","resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",- "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "peer": true},"node_modules/express/node_modules/cookie": {"version": "0.7.1",@@ -22197,6 +22179,7 @@"integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==","license": "Apache-2.0","optional": true,+ "peer": true,"dependencies": {"gaxios": "^5.0.0","json-bigint": "^1.0.0"@@ -22211,6 +22194,7 @@"integrity": "sha512-95hVgBRgEIRQQQHIbnxBXeHbW4TqFk4ZDJW7wmVtvYar72FdhRIo1UGOLS2eRAKCPEdPBWu+M7+A33D9CdX9rA==","license": "Apache-2.0","optional": true,+ "peer": true,"dependencies": {"extend": "^3.0.2","https-proxy-agent": "^5.0.0",@@ -27801,6 +27785,7 @@"version": "1.0.2","resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.0.2.tgz","integrity": "sha512-pZAE+FJLoyITytdqK0U5s+FIpjN0JP3OzFi/u8Rx+EV5/W+JTWGXG8xFzevE7AjBfDqHv/8vL8qQsIhHnqRkrA==",+ "peer": true,"engines": {"node": ">= 0.8"}@@ -28483,7 +28468,6 @@"version": "3.0.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-3.0.1.tgz","integrity": "sha512-I3EurrIQMlRc9IaAZnqRR044Phh2DXY+55o7uJ0V+hYZAcQYSuFWsc9q5PvyDHUSCe1Qxn/iBz+78s86zWnGag==",- "peer": true,"engines": {"node": ">=10"},@@ -28826,7 +28810,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"nanoid": "^3.3.11","picocolors": "^1.1.1",@@ -28916,7 +28899,6 @@"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz","integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==","license": "MIT",- "peer": true,"bin": {"prettier": "bin/prettier.cjs"},@@ -29351,6 +29333,7 @@"version": "1.0.0","resolved": "https://registry.npmjs.org/random-bytes/-/random-bytes-1.0.0.tgz","integrity": "sha512-iv7LhNVO047HzYR3InF6pUcUsPQiHTM1Qal51DcGSuZFBil1aBBWG5eHPNek7bvILMaYJ/8RU1e8w1AMdHmLQQ==",+ "peer": true,"engines": {"node": ">= 0.8"}@@ -29422,7 +29405,6 @@"resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz","integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==","license": "MIT",- "peer": true,"engines": {"node": ">=0.10.0"}@@ -29432,7 +29414,6 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz","integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==","license": "MIT",- "peer": true,"dependencies": {"scheduler": "^0.26.0"},@@ -32209,7 +32190,6 @@"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.4.tgz","integrity": "sha512-D3YaD0aRxR3mEcqnidIs7ReYJFVzWdd6fXJYUM8ixcQcJRGTka/b3saV0KflYhyVJXKhb947GndU35SxYNResQ==","license": "MIT",- "peer": true,"dependencies": {"ip-address": "^9.0.5","smart-buffer": "^4.2.0"@@ -33498,7 +33478,6 @@"integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "~0.25.0","get-tsconfig": "^4.7.5"@@ -33666,7 +33645,6 @@"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.2.tgz","integrity": "sha512-6l+RyNy7oAHDfxC4FzSJcz9vnjTKxrLpDG5M2Vu4SHRVNg6xzqZp6LYSR9zjqQTu8DU/f5xwxUdADOkbrIX2gQ==","dev": true,- "peer": true,"bin": {"tsc": "bin/tsc","tsserver": "bin/tsserver"@@ -33707,6 +33685,7 @@"version": "2.1.5","resolved": "https://registry.npmjs.org/uid-safe/-/uid-safe-2.1.5.tgz","integrity": "sha512-KPHm4VL5dDXKz01UuEd88Df+KzynaohSL9fBh096KWAxSKZQDI2uBrVqtvRM4rwrIrRRKsdLNML/lnaaVSRioA==",+ "peer": true,"dependencies": {"random-bytes": "~1.0.0"},@@ -34294,7 +34273,6 @@"integrity": "sha512-ZWyE8YXEXqJrrSLvYgrRP7p62OziLW7xI5HYGWFzOvupfAlrLvURSzv/FyGyy0eidogEM3ujU+kUG1zuHgb6Ug==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "^0.25.0","fdir": "^6.5.0",@@ -34905,7 +34883,6 @@"resolved": "https://registry.npmjs.org/zod/-/zod-3.24.3.tgz","integrity": "sha512-HhY1oqzWCQWuUqvBFnsyrtZRhyPeR7SUGv+C4+MsisMuVfSPx8HpwWqH8tRahSlt6M3PiFAcoeFhZAqIXTxoSg==","license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --git a/backend/package.json b/backend/package.jsonindex 5968f4cf91..e69f5f96f9 100644--- a/backend/package.json+++ b/backend/package.json@@ -141,6 +141,7 @@"@fastify/swagger-ui": "^3.1.0","@gitbeaker/rest": "^42.5.0","@google-cloud/kms": "^4.5.0",+ "@infisical/pg-view-generator": "^1.0.0","@infisical/quic": "^1.0.8","@modelcontextprotocol/sdk": "^1.24.3","@node-saml/passport-saml": "^5.1.0",diff --git a/backend/src/auto-start-migrations.ts b/backend/src/auto-start-migrations.tsindex 938358df14..497692e1e5 100644--- a/backend/src/auto-start-migrations.ts+++ b/backend/src/auto-start-migrations.ts@@ -8,8 +8,16 @@ import { Logger } from "pino";import { applyJitter, delay } from "@app/lib/delay";+import {+ acquireSanitizedSchemaLock,+ createSanitizedSchema,+ dropSanitizedSchema,+ releaseSanitizedSchemaLock+} from "./db/sanitized-schema";import { PgSqlLock } from "./keystore/keystore";+const SANITIZED_SCHEMA_ERROR = "SANITIZED_SCHEMA_ERROR";+dotenv.config();type TArgs = {@@ -284,7 +292,24 @@ const withStartupLock = async (db: Knex, logger: Logger, doMigrations: () => Pro};export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs) => {+ const generateSanitizedSchema = process.env.GENERATE_SANITIZED_SCHEMA === "true";+ let sanitizedLockAcquired = false;+try {+ // we drop the sanitized schema before migrations to avoid conflicts with the migrations+ if (generateSanitizedSchema) {+ try {+ await acquireSanitizedSchemaLock({ db: applicationDb, logger });+ sanitizedLockAcquired = true;+ await dropSanitizedSchema({ db: applicationDb, logger });+ } catch (err) {+ logger.error(+ { err, errorId: SANITIZED_SCHEMA_ERROR, phase: "drop" },+ `${SANITIZED_SCHEMA_ERROR}: Failed to drop sanitized schema before migrations`+ );+ }+ }+// akhilmhdh(Feb 10 2025): 2 years from now remove thisif (isProduction) {const migrationTable = migrationConfig.tableName;@@ -315,6 +340,18 @@ export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgs); // db.length - code.lengthif (!shouldRunMigration) {logger.info("No migrations pending: Skipping migration process.");++ if (generateSanitizedSchema) {+ try {+ await createSanitizedSchema({ db: applicationDb, logger });+ logger.info("Finished sanitized schema generation.");+ } catch (err) {+ logger.error(+ { err, errorId: SANITIZED_SCHEMA_ERROR, phase: "create" },+ `${SANITIZED_SCHEMA_ERROR}: Failed to create sanitized schema`+ );+ }+ }return;}@@ -351,8 +388,32 @@ export const runMigrations = async ({ applicationDb, auditLogDb, logger }: TArgsawait applicationDb.migrate.latest(migrationConfig);});logger.info("Finished application migrations.");++ // we create the sanitized schema after migrations to avoid conflicts with the migrations+ if (generateSanitizedSchema) {+ try {+ await createSanitizedSchema({ db: applicationDb, logger });+ logger.info("Finished sanitized schema generation.");+ } catch (err) {+ logger.error(+ { err, errorId: SANITIZED_SCHEMA_ERROR, phase: "create" },+ `${SANITIZED_SCHEMA_ERROR}: Failed to create sanitized schema after migrations`+ );+ }+ }} catch (err) {logger.error(err, "Boot up migration failed");process.exit(1);+ } finally {+ if (sanitizedLockAcquired) {+ try {+ await releaseSanitizedSchemaLock({ db: applicationDb, logger });+ } catch (err) {+ logger.error(+ { err, errorId: SANITIZED_SCHEMA_ERROR, phase: "unlock" },+ `${SANITIZED_SCHEMA_ERROR}: Failed to release sanitized schema lock`+ );+ }+ }}};diff --git a/backend/src/db/sanitized-schema.ts b/backend/src/db/sanitized-schema.tsnew file mode 100644index 0000000000..1b39cf9507--- /dev/null+++ b/backend/src/db/sanitized-schema.ts@@ -0,0 +1,63 @@+import path from "path";++import { Knex } from "knex";+import { Logger } from "pino";++import { PgSqlLock } from "@app/keystore/keystore";++const SANITIZED_SCHEMA = "infisical-sanitized";++type TArgs = {+ db: Knex;+ logger: Logger;+};++export const acquireSanitizedSchemaLock = async ({ db, logger }: TArgs): Promise<void> => {+ await db.raw("SELECT pg_advisory_lock(?)", [PgSqlLock.SanitizedSchemaGeneration]);+ logger.info("Acquired sanitized schema generation lock");+};++export const releaseSanitizedSchemaLock = async ({ db, logger }: TArgs): Promise<void> => {+ await db.raw("SELECT pg_advisory_unlock(?)", [PgSqlLock.SanitizedSchemaGeneration]);+ logger.info("Released sanitized schema generation lock");+};++export const dropSanitizedSchema = async ({ db, logger }: TArgs): Promise<void> => {+ await db.raw(`DROP SCHEMA IF EXISTS "${SANITIZED_SCHEMA}" CASCADE`);+ logger.info("Dropped existing sanitized schema");+};++/* Validate the generated SQL to ensure it only contains CREATE SCHEMA IF NOT EXISTS and CREATE VIEW statements.+ * This is to prevent SQL injection and other security vulnerabilities as we'll be doing raw SQL execution.+ */+const validateGeneratedSQL = (sql: string): void => {+ const statements = sql+ .split(";")+ .map((s) => s.trim())+ .filter((s) => s.length > 0 && !s.startsWith("--"));++ for (const statement of statements) {+ const upper = statement.toUpperCase();+ const isAllowed = upper.startsWith("CREATE SCHEMA IF NOT EXISTS") || upper.startsWith("CREATE VIEW");++ if (!isAllowed) {+ throw new Error(+ `SANITIZED_SCHEMA_SECURITY_VIOLATION: Only CREATE SCHEMA IF NOT EXISTS and CREATE VIEW allowed. ` ++ `Got: ${statement.substring(0, 100)}`+ );+ }+ }+};++export const createSanitizedSchema = async ({ db, logger }: TArgs): Promise<void> => {+ // eslint-disable-next-line import/no-extraneous-dependencies+ const { loadConfig, generateSQL } = await import("@infisical/pg-view-generator");++ const config = await loadConfig(path.join(__dirname, "sanitized-schema.yaml"));+ const sql = generateSQL(config, { targetSchema: SANITIZED_SCHEMA });++ validateGeneratedSQL(sql);++ await db.raw(sql);+ logger.info("Created sanitized schema and views");+};diff --git a/backend/src/db/sanitized-schema.yaml b/backend/src/db/sanitized-schema.yamlnew file mode 100644index 0000000000..1a434f20b2--- /dev/null+++ b/backend/src/db/sanitized-schema.yaml@@ -0,0 +1,1361 @@++tables:+ - name: access_approval_requests+ source: public.access_approval_requests+ columns:+ - id+ - policyId+ - privilegeId+ - isTemporary+ - temporaryRange+ - permissions+ - createdAt+ - updatedAt+ - note+ - privilegeDeletedAt+ - status+ - editedByUserId+ - editNote++ - name: ai_mcp_activity_logs+ source: public.ai_mcp_activity_logs+ columns:+ - id+ - projectId+ - endpointName+ - serverName+ - toolName+ - actor+ - createdAt+ - updatedAt++ - name: ai_mcp_endpoint_server_tools+ source: public.ai_mcp_endpoint_server_tools+ columns:+ - id+ - aiMcpEndpointId+ - aiMcpServerToolId+ - isEnabled++ - name: ai_mcp_endpoint_servers+ source: public.ai_mcp_endpoint_servers+ columns:+ - id+ - aiMcpEndpointId+ - aiMcpServerId++ - name: ai_mcp_endpoints+ source: public.ai_mcp_endpoints+ columns:+ - id+ - name+ - description+ - status+ - projectId+ - createdAt+ - updatedAt++ - name: ai_mcp_server_tools+ source: public.ai_mcp_server_tools+ columns:+ - id+ - name+ - description+ - inputSchema+ - aiMcpServerId++ - name: ai_mcp_servers+ source: public.ai_mcp_servers+ columns:+ - id+ - name+ - url+ - description+ - status+ - credentialMode+ - authMethod+ - projectId+ - createdAt+ - updatedAt++ - name: app_connections+ source: public.app_connections+ columns:+ - id+ - name+ - description+ - app+ - method+ - version+ - orgId+ - createdAt+ - updatedAt+ - isPlatformManagedCredentials+ - gatewayId+ - projectId++ - name: approval_requests+ source: public.approval_requests+ columns:+ - id+ - projectId+ - organizationId+ - policyId+ - requesterId+ - requesterName+ - requesterEmail+ - type+ - status+ - justification+ - currentStep+ - expiresAt+ - createdAt+ - updatedAt++ - name: certificate_authorities+ source: public.certificate_authorities+ columns:+ - id+ - createdAt+ - updatedAt+ - projectId+ - status+ - enableDirectIssuance+ - name++ - name: certificate_requests+ source: public.certificate_requests+ columns:+ - id+ - createdAt+ - updatedAt+ - status+ - projectId+ - profileId+ - caId+ - certificateId+ - csr+ - commonName+ - altNames+ - keyUsages+ - extendedKeyUsages+ - notBefore+ - notAfter+ - keyAlgorithm+ - signatureAlgorithm+ - errorMessage+ - metadata+ - acmeOrderId++ - name: certificate_syncs+ source: public.certificate_syncs+ columns:+ - id+ - pkiSyncId+ - certificateId+ - syncStatus+ - lastSyncMessage+ - lastSyncedAt+ - createdAt+ - updatedAt+ - externalIdentifier++ - name: certificates+ source: public.certificates+ columns:+ - id+ - createdAt+ - updatedAt+ - caId+ - status+ - serialNumber+ - friendlyName+ - commonName+ - notBefore+ - notAfter+ - revokedAt+ - revocationReason+ - altNames+ - caCertId+ - keyUsages+ - extendedKeyUsages+ - pkiSubscriberId+ - projectId+ - profileId+ - renewBeforeDays++ - name: dynamic_secret_leases+ source: public.dynamic_secret_leases+ columns:+ - id+ - version+ - externalEntityId+ - expireAt+ - status+ - statusDetails+ - dynamicSecretId+ - createdAt+ - updatedAt+ - config++ - name: dynamic_secrets+ source: public.dynamic_secrets+ columns:+ - id+ - name+ - version+ - type+ - defaultTTL+ - maxTTL+ - folderId+ - status+ - statusDetails+ - createdAt+ - updatedAt+ - projectGatewayId+ - gatewayId+ - usernameTemplate+ - gatewayV2Id++ - name: external_certificate_authorities+ source: public.external_certificate_authorities+ columns:+ - id+ - type+ - appConnectionId+ - dnsAppConnectionId+ - caId+ - credentials+ - configuration++ - name: external_kms+ source: public.external_kms+ columns:+ - id+ - provider+ - status+ - statusDetails+ - kmsKeyId++ - name: gateways_v2+ source: public.gateways_v2+ columns:+ - id+ - createdAt+ - updatedAt+ - orgId+ - identityId+ - relayId+ - name+ - heartbeat+ - healthAlertedAt++ - name: groups+ source: public.groups+ columns:+ - id+ - orgId+ - name+ - slug+ - createdAt+ - updatedAt++ - name: identities+ source: public.identities+ columns:+ - id+ - name+ - authMethod+ - createdAt+ - updatedAt+ - hasDeleteProtection+ - orgId+ - projectId++ - name: identity_alicloud_auths+ source: public.identity_alicloud_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - type+ - allowedArns++ - name: identity_auth_templates+ source: public.identity_auth_templates+ columns:+ - id+ - templateFields+ - orgId+ - name+ - authMethod+ - createdAt+ - updatedAt++ - name: identity_aws_auths+ source: public.identity_aws_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - type+ - stsEndpoint+ - allowedPrincipalArns+ - allowedAccountIds+ - accessTokenPeriod++ - name: identity_azure_auths+ source: public.identity_azure_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - tenantId+ - resource+ - allowedServicePrincipalIds+ - accessTokenPeriod++ - name: identity_gcp_auths+ source: public.identity_gcp_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - type+ - allowedServiceAccounts+ - allowedProjects+ - allowedZones+ - accessTokenPeriod++ - name: identity_group_membership+ source: public.identity_group_membership+ columns:+ - id+ - identityId+ - groupId+ - createdAt+ - updatedAt++ - name: identity_jwt_auths+ source: public.identity_jwt_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - identityId+ - configurationType+ - jwksUrl+ - boundIssuer+ - boundAudiences+ - boundClaims+ - boundSubject+ - createdAt+ - updatedAt+ - accessTokenPeriod++ - name: identity_kubernetes_auths+ source: public.identity_kubernetes_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - kubernetesHost+ - allowedNamespaces+ - allowedNames+ - allowedAudience+ - gatewayId+ - accessTokenPeriod+ - tokenReviewMode+ - gatewayV2Id++ - name: identity_ldap_auths+ source: public.identity_ldap_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - identityId+ - url+ - searchBase+ - searchFilter+ - allowedFields+ - createdAt+ - updatedAt+ - accessTokenPeriod+ - templateId+ - lockoutEnabled+ - lockoutThreshold+ - lockoutDurationSeconds+ - lockoutCounterResetSeconds++ - name: identity_oci_auths+ source: public.identity_oci_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - type+ - tenancyOcid+ - allowedUsernames+ - accessTokenPeriod++ - name: identity_oidc_auths+ source: public.identity_oidc_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - identityId+ - oidcDiscoveryUrl+ - boundIssuer+ - boundAudiences+ - boundClaims+ - boundSubject+ - createdAt+ - updatedAt+ - claimMetadataMapping+ - accessTokenPeriod++ - name: identity_tls_cert_auths+ source: public.identity_tls_cert_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - allowedCommonNames++ - name: identity_token_auths+ source: public.identity_token_auths+ columns:+ - id+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - accessTokenPeriod++ - name: identity_universal_auths+ source: public.identity_universal_auths+ columns:+ - id+ - clientId+ - accessTokenTTL+ - accessTokenMaxTTL+ - accessTokenNumUsesLimit+ - clientSecretTrustedIps+ - accessTokenTrustedIps+ - createdAt+ - updatedAt+ - identityId+ - accessTokenPeriod+ - lockoutEnabled+ - lockoutThreshold+ - lockoutDurationSeconds+ - lockoutCounterResetSeconds++ - name: integrations+ source: public.integrations+ columns:+ - id+ - isActive+ - url+ - app+ - appId+ - targetEnvironment+ - targetEnvironmentId+ - targetService+ - targetServiceId+ - owner+ - path+ - region+ - scope+ - integration+ - metadata+ - integrationAuthId+ - envId+ - secretPath+ - createdAt+ - updatedAt+ - lastUsed+ - isSynced+ - syncMessage+ - lastSyncJobId++ - name: intermediate_certificate_requests+ source: public.intermediate_certificate_requests+ columns:+ - id+ - createdAt+ - updatedAt+ - status+ - projectId+ - profileId+ - caId+ - certificateId+ - commonName+ - altNames+ - keyUsages+ - extendedKeyUsages+ - notBefore+ - notAfter+ - keyAlgorithm+ - signatureAlgorithm+ - errorMessage+ - metadata+ - acmeOrderId++ - name: internal_certificate_authorities+ source: public.internal_certificate_authorities+ columns:+ - id+ - parentCaId+ - type+ - friendlyName+ - organization+ - ou+ - country+ - province+ - locality+ - commonName+ - dn+ - serialNumber+ - maxPathLength+ - keyAlgorithm+ - notBefore+ - notAfter+ - activeCaCertId+ - caId++ - name: kmip_clients+ source: public.kmip_clients+ columns:+ - id+ - name+ - permissions+ - description+ - projectId++ - name: kms_keys+ source: public.kms_keys+ columns:+ - id+ - description+ - isDisabled+ - isReserved+ - orgId+ - name+ - createdAt+ - updatedAt+ - projectId+ - keyUsage+ - kmipMetadata++ - name: ldap_configs+ source: public.ldap_configs+ columns:+ - id+ - orgId+ - isActive+ - url+ - searchBase+ - groupSearchBase+ - groupSearchFilter+ - searchFilter+ - uniqueUserAttribute+ - createdAt+ - updatedAt++ - name: membership_roles+ source: public.membership_roles+ columns:+ - id+ - role+ - isTemporary+ - temporaryMode+ - temporaryRange+ - temporaryAccessStartTime+ - temporaryAccessEndTime+ - customRoleId+ - membershipId+ - createdAt+ - updatedAt++ - name: memberships+ source: public.memberships+ columns:+ - id+ - scope+ - actorUserId+ - actorIdentityId+ - actorGroupId+ - scopeOrgId+ - scopeProjectId+ - scopeNamespaceId+ - isActive+ - status+ - inviteEmail+ - lastInvitedAt+ - lastLoginAuthMethod+ - lastLoginTime+ - projectFavorites+ - createdAt+ - updatedAt++ - name: microsoft_teams_integrations+ source: public.microsoft_teams_integrations+ columns:+ - id+ - internalTeamsAppId+ - tenantId+ - accessTokenExpiresAt+ - botAccessTokenExpiresAt+ - createdAt+ - updatedAt++ - name: namespaces+ source: public.namespaces+ columns:+ - id+ - name+ - description+ - orgId+ - createdAt+ - updatedAt++ - name: oidc_configs+ source: public.oidc_configs+ columns:+ - id+ - discoveryURL+ - issuer+ - authorizationEndpoint+ - jwksUri+ - tokenEndpoint+ - userinfoEndpoint+ - configurationType+ - allowedEmailDomains+ - isActive+ - createdAt+ - updatedAt+ - orgId+ - lastUsed+ - manageGroupMemberships+ - jwtSignatureAlgorithm++ - name: org_relay_config+ source: public.org_relay_config+ columns:+ - id+ - createdAt+ - updatedAt+ - orgId++ - name: organizations+ source: public.organizations+ columns:+ - id+ - name+ - customerId+ - slug+ - createdAt+ - updatedAt+ - authEnforced+ - scimEnabled+ - kmsDefaultKeyId+ - defaultMembershipRole+ - enforceMfa+ - selectedMfaMethod+ - allowSecretSharingOutsideOrganization+ - shouldUseNewPrivilegeSystem+ - privilegeUpgradeInitiatedByUsername+ - privilegeUpgradeInitiatedAt+ - bypassOrgAuthEnabled+ - userTokenExpiration+ - secretsProductEnabled+ - pkiProductEnabled+ - kmsProductEnabled+ - sshProductEnabled+ - scannerProductEnabled+ - shareSecretsProductEnabled+ - maxSharedSecretLifetime+ - maxSharedSecretViewLimit+ - googleSsoAuthEnforced+ - googleSsoAuthLastUsed+ - parentOrgId+ - rootOrgId+ - blockDuplicateSecretSyncDestinations++ - name: pam_accounts+ source: public.pam_accounts+ columns:+ - id+ - projectId+ - folderId+ - resourceId+ - name+ - description+ - createdAt+ - updatedAt+ - rotationEnabled+ - rotationIntervalSeconds+ - lastRotatedAt+ - rotationStatus++ - name: pam_resources+ source: public.pam_resources+ columns:+ - id+ - projectId+ - name+ - gatewayId+ - resourceType+ - createdAt+ - updatedAt++ - name: pam_sessions+ source: public.pam_sessions+ columns:+ - id+ - projectId+ - accountId+ - resourceType+ - resourceName+ - accountName+ - userId+ - actorName+ - actorEmail+ - actorIp+ - actorUserAgent+ - status+ - expiresAt+ - startedAt+ - endedAt+ - createdAt+ - updatedAt++ - name: pki_alerts_v2+ source: public.pki_alerts_v2+ columns:+ - id+ - name+ - description+ - eventType+ - alertBefore+ - filters+ - enabled+ - projectId+ - createdAt+ - updatedAt++ - name: pki_certificate_profiles+ source: public.pki_certificate_profiles+ columns:+ - id+ - projectId+ - caId+ - slug+ - description+ - enrollmentType+ - estConfigId+ - apiConfigId+ - createdAt+ - updatedAt+ - acmeConfigId+ - issuerType+ - externalConfigs+++ - name: pki_syncs+ source: public.pki_syncs+ columns:+ - id+ - name+ - description+ - destination+ - isAutoSyncEnabled+ - version+ - destinationConfig+ - syncOptions+ - projectId+ - subscriberId+ - connectionId+ - createdAt+ - updatedAt+ - syncStatus+ - lastSyncJobId+ - lastSyncMessage+ - lastSyncedAt+ - importStatus+ - lastImportJobId+ - lastImportMessage+ - lastImportedAt+ - removeStatus+ - lastRemoveJobId+ - lastRemoveMessage+ - lastRemovedAt++ - name: project_environments+ source: public.project_environments+ columns:+ - id+ - name+ - slug+ - position+ - projectId+ - createdAt+ - updatedAt++ - name: project_gateways+ source: public.project_gateways+ columns:+ - id+ - projectId+ - gatewayId+ - createdAt+ - updatedAt++ - name: project_microsoft_teams_configs+ source: public.project_microsoft_teams_configs+ columns:+ - id+ - projectId+ - microsoftTeamsIntegrationId+ - isAccessRequestNotificationEnabled+ - isSecretRequestNotificationEnabled+ - accessRequestChannels+ - secretRequestChannels+ - createdAt+ - updatedAt++ - name: project_slack_configs+ source: public.project_slack_configs+ columns:+ - id+ - projectId+ - slackIntegrationId+ - isAccessRequestNotificationEnabled+ - accessRequestChannels+ - isSecretRequestNotificationEnabled+ - secretRequestChannels+ - createdAt+ - updatedAt+ - isSecretSyncErrorNotificationEnabled+ - secretSyncErrorChannels++ - name: project_templates+ source: public.project_templates+ columns:+ - id+ - name+ - description+ - roles+ - environments+ - orgId+ - createdAt+ - updatedAt+ - type++ - name: projects+ source: public.projects+ columns:+ - id+ - name+ - slug+ - autoCapitalization+ - orgId+ - createdAt+ - updatedAt+ - version+ - upgradeStatus+ - pitVersionLimit+ - auditLogsRetentionDays+ - description+ - type+ - enforceCapitalization+ - hasDeleteProtection+ - secretSharing+ - showSnapshotsLegacy+ - defaultProduct+ - secretDetectionIgnoreValues++ - name: rate_limit+ source: public.rate_limit+ columns:+ - id+ - readRateLimit+ - writeRateLimit+ - secretsRateLimit+ - authRateLimit+ - inviteUserRateLimit+ - mfaRateLimit+ - publicEndpointLimit+ - createdAt+ - updatedAt++ - name: relays+ source: public.relays+ columns:+ - id+ - createdAt+ - updatedAt+ - orgId+ - identityId+ - name+ - host+ - heartbeat+ - healthAlertedAt++ - name: reminders+ source: public.reminders+ columns:+ - id+ - secretId+ - message+ - repeatDays+ - nextReminderDate+ - createdAt+ - updatedAt+ - fromDate++ - name: roles+ source: public.roles+ columns:+ - id+ - name+ - description+ - slug+ - permissions+ - orgId+ - projectId+ - namespaceId+ - createdAt+ - updatedAt++ - name: saml_configs+ source: public.saml_configs+ columns:+ - id+ - authProvider+ - isActive+ - createdAt+ - updatedAt+ - orgId+ - lastUsed+ - enableGroupSync++ - name: secret_approval_policies+ source: public.secret_approval_policies+ columns:+ - id+ - name+ - secretPath+ - approvals+ - envId+ - createdAt+ - updatedAt+ - enforcementLevel+ - deletedAt+ - allowedSelfApprovals++ - name: secret_approval_requests+ source: public.secret_approval_requests+ columns:+ - id+ - policyId+ - hasMerged+ - status+ - conflicts+ - slug+ - folderId+ - createdAt+ - updatedAt+ - isReplicated+ - committerUserId+ - statusChangedByUserId+ - bypassReason++ - name: secret_folders+ source: public.secret_folders+ columns:+ - id+ - name+ - version+ - createdAt+ - updatedAt+ - envId+ - parentId+ - isReserved+ - description+ - lastSecretModified++ - name: secret_imports+ source: public.secret_imports+ columns:+ - id+ - version+ - importPath+ - importEnv+ - position+ - createdAt+ - updatedAt+ - folderId+ - isReplication+ - isReplicationSuccess+ - replicationStatus+ - lastReplicated+ - isReserved++ - name: secret_rotations+ source: public.secret_rotations+ columns:+ - id+ - provider+ - secretPath+ - interval+ - lastRotatedAt+ - status+ - statusMessage+ - algorithm+ - keyEncoding+ - envId+ - createdAt+ - updatedAt++ - name: secret_rotations_v2+ source: public.secret_rotations_v2+ columns:+ - id+ - name+ - description+ - type+ - parameters+ - secretsMapping+ - isAutoRotationEnabled+ - activeIndex+ - folderId+ - connectionId+ - createdAt+ - updatedAt+ - rotationInterval+ - rotateAtUtc+ - rotationStatus+ - lastRotationAttemptedAt+ - lastRotatedAt+ - nextRotationAt+ - isLastRotationManual++ - name: secret_scanning_data_sources+ source: public.secret_scanning_data_sources+ columns:+ - id+ - externalId+ - name+ - description+ - type+ - config+ - connectionId+ - isAutoScanEnabled+ - projectId+ - createdAt+ - updatedAt+ - isDisconnected++ - name: secret_scanning_findings+ source: public.secret_scanning_findings+ columns:+ - id+ - dataSourceName+ - dataSourceType+ - resourceName+ - resourceType+ - rule+ - severity+ - status+ - remarks+ - fingerprint+ - details+ - projectId+ - scanId+ - createdAt+ - updatedAt++ - name: secret_scanning_git_risks+ source: public.secret_scanning_git_risks+ columns:+ - id+ - description+ - entropy+ - date+ - message+ - tags+ - ruleID+ - isFalsePositive+ - isResolved+ - riskOwner+ - pusherName+ - pusherEmail+ - status+ - orgId+ - createdAt+ - updatedAt++ - name: secret_scanning_resources+ source: public.secret_scanning_resources+ columns:+ - id+ - externalId+ - name+ - type+ - dataSourceId+ - createdAt+ - updatedAt++ - name: secret_sharing+ source: public.secret_sharing+ columns:+ - id+ - hashedHex+ - expiresAt+ - userId+ - orgId+ - createdAt+ - updatedAt+ - expiresAfterViews+ - accessType+ - name+ - lastViewedAt+ - identifier+ - type+ - authorizedEmails++ - name: secret_syncs+ source: public.secret_syncs+ columns:+ - id+ - name+ - description+ - destination+ - isAutoSyncEnabled+ - version+ - destinationConfig+ - syncOptions+ - projectId+ - folderId+ - connectionId+ - createdAt+ - updatedAt+ - syncStatus+ - lastSyncJobId+ - lastSyncMessage+ - lastSyncedAt+ - importStatus+ - lastImportJobId+ - lastImportMessage+ - lastImportedAt+ - removeStatus+ - lastRemoveJobId+ - lastRemoveMessage+ - lastRemovedAt++ - name: secret_tags+ source: public.secret_tags+ columns:+ - id+ - slug+ - color+ - createdAt+ - updatedAt+ - createdBy+ - projectId+ - createdByActorType++ - name: secrets+ source: public.secrets+ columns:+ - id+ - version+ - type+ - secretBlindIndex+ - secretReminderNote+ - secretReminderRepeatDays+ - skipMultilineEncoding+ - algorithm+ - keyEncoding+ - metadata+ - userId+ - folderId+ - createdAt+ - updatedAt++ - name: secrets_v2+ source: public.secrets_v2+ columns:+ - id+ - version+ - type+ - key+ - reminderNote+ - reminderRepeatDays+ - skipMultilineEncoding+ - metadata+ - userId+ - folderId+ - createdAt+ - updatedAt++ - name: service_tokens+ source: public.service_tokens+ columns:+ - id+ - name+ - scopes+ - lastUsed+ - expiresAt+ - createdAt+ - updatedAt+ - createdBy+ - projectId+ - expiryNotificationSent++ - name: ssh_certificate_authorities+ source: public.ssh_certificate_authorities+ columns:+ - id+ - createdAt+ - updatedAt+ - projectId+ - status+ - friendlyName+ - keyAlgorithm+ - keySource++ - name: ssh_certificates+ source: public.ssh_certificates+ columns:+ - id+ - createdAt+ - updatedAt+ - sshCaId+ - sshCertificateTemplateId+ - serialNumber+ - certType+ - principals+ - keyId+ - notBefore+ - notAfter+ - sshHostId++ - name: ssh_host_groups+ source: public.ssh_host_groups+ columns:+ - id+ - createdAt+ - updatedAt+ - projectId+ - name++ - name: ssh_hosts+ source: public.ssh_hosts+ columns:+ - id+ - createdAt+ - updatedAt+ - projectId+ - hostname+ - userCertTtl+ - hostCertTtl+ - userSshCaId+ - hostSshCaId+ - alias++ - name: user_group_membership+ source: public.user_group_membership+ columns:+ - id+ - userId+ - groupId+ - createdAt+ - updatedAt+ - isPending++ - name: users+ source: public.users+ columns:+ - id+ - authMethods+ - superAdmin+ - firstName+ - lastName+ - isAccepted+ - isMfaEnabled+ - mfaMethods+ - devices+ - createdAt+ - updatedAt+ - isGhost+ - username+ - isEmailVerified+ - consecutiveFailedMfaAttempts+ - isLocked+ - temporaryLockDateEnd+ - consecutiveFailedPasswordAttempts+ - selectedMfaMethod++ - name: webhooks+ source: public.webhooks+ columns:+ - id+ - secretPath+ - lastStatus+ - lastRunErrorMessage+ - isDisabled+ - createdAt+ - updatedAt+ - envId+ - type+ - urldiff --git a/backend/src/keystore/keystore.ts b/backend/src/keystore/keystore.tsindex 45b633de93..1f1888f73e 100644--- a/backend/src/keystore/keystore.ts+++ b/backend/src/keystore/keystore.ts@@ -14,6 +14,7 @@ export const PgSqlLock = {BootUpMigration: 2023,SuperAdminInit: 2024,KmsRootKeyInit: 2025,+ SanitizedSchemaGeneration: 2026,OrgGatewayRootCaInit: (orgId: string) => pgAdvisoryLockHashText(`org-gateway-root-ca:${orgId}`),OrgGatewayCertExchange: (orgId: string) => pgAdvisoryLockHashText(`org-gateway-cert-exchange:${orgId}`),SecretRotationV2Creation: (folderId: string) => pgAdvisoryLockHashText(`secret-rotation-v2-creation:${folderId}`),diff --git a/backend/src/lib/config/env.ts b/backend/src/lib/config/env.tsindex 1af9c3d109..1ee8032e3c 100644--- a/backend/src/lib/config/env.ts+++ b/backend/src/lib/config/env.ts@@ -86,6 +86,9 @@ const envSchema = zz.string().describe("Postgres database base64-encoded CA cert for Audit logs").optional()),DISABLE_AUDIT_LOG_STORAGE: zodStrBool.default("false").optional().describe("Disable audit log storage"),+ GENERATE_SANITIZED_SCHEMA: zodStrBool+ .default("false")+ .describe("Generate sanitized schema with views after migrations"),MAX_LEASE_LIMIT: z.coerce.number().default(10000),DB_ROOT_CERT: zpStr(z.string().describe("Postgres database base64-encoded CA cert").optional()),DB_HOST: zpStr(z.string().describe("Postgres database host").optional()),diff --git a/backend/tsup.config.js b/backend/tsup.config.jsindex 80ec73a14f..5f80849778 100644--- a/backend/tsup.config.js+++ b/backend/tsup.config.js@@ -24,7 +24,8 @@ export default defineConfig({".handlebars": "copy",".md": "copy",".txt": "copy",- ".pem": "copy"+ ".pem": "copy",+ ".yaml": "copy"},external: ["../../../frontend/node_modules/next/dist/server/next-server.js"],outDir: "dist",