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
local account discovery
x03220558b89507ba9d
diff --git a/backend/package-lock.json b/backend/package-lock.jsonindex 855ca71f9d..e871029033 100644--- a/backend/package-lock.json+++ b/backend/package-lock.json@@ -80,6 +80,7 @@"connect-redis": "^7.1.1","cron": "^3.1.7","dd-trace": "^5.40.0",+ "dns-packet": "^5.6.1","dotenv": "^16.4.1","fastify": "^4.29.1","fastify-plugin": "^4.5.1",@@ -144,6 +145,7 @@"tweetnacl": "^1.0.3","tweetnacl-util": "^0.15.1","uuid": "^9.0.1",+ "winrm-client": "^0.0.11","zod": "^3.22.4","zod-to-json-schema": "^3.24.5"},@@ -156,6 +158,7 @@"@react-email/preview-server": "^5.0.6","@smithy/types": "^4.3.1","@types/bcrypt": "^5.0.2",+ "@types/dns-packet": "^5.6.5","@types/jmespath": "^0.15.2","@types/js-yaml": "^4.0.9","@types/jsonwebtoken": "^9.0.5",@@ -13967,6 +13970,9 @@"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",@@ -14175,6 +14181,12 @@"resolved": "https://registry.npmjs.org/@ldapjs/protocol/-/protocol-1.2.1.tgz","integrity": "sha512-O89xFDLW2gBoZWNXuXpBSM32/KealKCTb3JGtJdtUQc7RjAk8XzrRgyz02cPAwGKwKPxy0ivuC7UP9bmN87egQ=="},+ "node_modules/@leichtgewicht/ip-codec": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/@leichtgewicht/ip-codec/-/ip-codec-2.0.5.tgz",+ "integrity": "sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==",+ "license": "MIT"+ },"node_modules/@levischuck/tiny-cbor": {"version": "0.2.11","resolved": "https://registry.npmjs.org/@levischuck/tiny-cbor/-/tiny-cbor-0.2.11.tgz",@@ -18766,6 +18778,16 @@"dev": true,"license": "MIT"},+ "node_modules/@types/dns-packet": {+ "version": "5.6.5",+ "resolved": "https://registry.npmjs.org/@types/dns-packet/-/dns-packet-5.6.5.tgz",+ "integrity": "sha512-qXOC7XLOEe43ehtWJCMnQXvgcIpv6rPmQ1jXT98Ad8A3TB1Ue50jsCbSSSyuazScEuZ/Q026vHbrOTVkmwA+7Q==",+ "dev": true,+ "license": "MIT",+ "dependencies": {+ "@types/node": "*"+ }+ },"node_modules/@types/estree": {"version": "1.0.8","resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",@@ -20564,6 +20586,21 @@"node": ">=4.0"}},+ "node_modules/aws-sign2": {+ "version": "0.7.0",+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",+ "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==",+ "license": "Apache-2.0",+ "engines": {+ "node": "*"+ }+ },+ "node_modules/aws4": {+ "version": "1.13.2",+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.13.2.tgz",+ "integrity": "sha512-lHe62zvbTB5eEABUVi/AwVh0ZKY9rMMDhmm+eeyuuUQbQ3+J+fONVQOZyj+DdrvD4BY33uYniyRJ4UJIaSKAfw==",+ "license": "MIT"+ },"node_modules/axios": {"version": "1.12.2","resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",@@ -21437,6 +21474,12 @@],"license": "CC-BY-4.0"},+ "node_modules/caseless": {+ "version": "0.12.0",+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",+ "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==",+ "license": "Apache-2.0"+ },"node_modules/cassandra-driver": {"version": "4.7.2","resolved": "https://registry.npmjs.org/cassandra-driver/-/cassandra-driver-4.7.2.tgz",@@ -22467,6 +22510,18 @@"node": ">=8"}},+ "node_modules/dns-packet": {+ "version": "5.6.1",+ "resolved": "https://registry.npmjs.org/dns-packet/-/dns-packet-5.6.1.tgz",+ "integrity": "sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==",+ "license": "MIT",+ "dependencies": {+ "@leichtgewicht/ip-codec": "^2.0.1"+ },+ "engines": {+ "node": ">=6"+ }+ },"node_modules/doctrine": {"version": "3.0.0","resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",@@ -23841,8 +23896,7 @@"node_modules/fast-json-stable-stringify": {"version": "2.1.0","resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",- "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",- "dev": true+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="},"node_modules/fast-json-stringify": {"version": "5.9.1",@@ -24333,6 +24387,15 @@"url": "https://github.com/sponsors/isaacs"}},+ "node_modules/forever-agent": {+ "version": "0.6.1",+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",+ "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==",+ "license": "Apache-2.0",+ "engines": {+ "node": "*"+ }+ },"node_modules/form-data": {"version": "4.0.4","resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",@@ -24575,38 +24638,6 @@"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz","integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="},- "node_modules/gcp-metadata": {- "version": "5.3.0",- "resolved": "https://registry.npmjs.org/gcp-metadata/-/gcp-metadata-5.3.0.tgz",- "integrity": "sha512-FNTkdNEnBdlqF2oatizolQqNANMrcqJt6AAYt99B3y1aLLC8Hc5IOBb+ZnnzllodEEf6xMBp6wRcBbc16fa65w==",- "license": "Apache-2.0",- "optional": true,- "peer": true,- "dependencies": {- "gaxios": "^5.0.0",- "json-bigint": "^1.0.0"- },- "engines": {- "node": ">=12"- }- },- "node_modules/gcp-metadata/node_modules/gaxios": {- "version": "5.1.3",- "resolved": "https://registry.npmjs.org/gaxios/-/gaxios-5.1.3.tgz",- "integrity": "sha512-95hVgBRgEIRQQQHIbnxBXeHbW4TqFk4ZDJW7wmVtvYar72FdhRIo1UGOLS2eRAKCPEdPBWu+M7+A33D9CdX9rA==",- "license": "Apache-2.0",- "optional": true,- "peer": true,- "dependencies": {- "extend": "^3.0.2",- "https-proxy-agent": "^5.0.0",- "is-stream": "^2.0.0",- "node-fetch": "^2.6.9"- },- "engines": {- "node": ">=12"- }- },"node_modules/generate-function": {"version": "2.3.1","resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",@@ -25012,6 +25043,51 @@"uglify-js": "^3.1.4"}},+ "node_modules/har-schema": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",+ "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==",+ "license": "ISC",+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/har-validator": {+ "version": "5.1.5",+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz",+ "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==",+ "deprecated": "this library is no longer supported",+ "license": "MIT",+ "dependencies": {+ "ajv": "^6.12.3",+ "har-schema": "^2.0.0"+ },+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/har-validator/node_modules/ajv": {+ "version": "6.14.0",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",+ "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==",+ "license": "MIT",+ "dependencies": {+ "fast-deep-equal": "^3.1.1",+ "fast-json-stable-stringify": "^2.0.0",+ "json-schema-traverse": "^0.4.1",+ "uri-js": "^4.2.2"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/epoberezkin"+ }+ },+ "node_modules/har-validator/node_modules/json-schema-traverse": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",+ "license": "MIT"+ },"node_modules/has-bigints": {"version": "1.0.2","resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz",@@ -25977,6 +26053,12 @@"url": "https://github.com/sponsors/ljharb"}},+ "node_modules/is-typedarray": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",+ "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==",+ "license": "MIT"+ },"node_modules/is-unicode-supported": {"version": "1.3.0","resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz",@@ -26043,6 +26125,12 @@"whatwg-fetch": "^3.4.1"}},+ "node_modules/isstream": {+ "version": "0.1.2",+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",+ "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",+ "license": "MIT"+ },"node_modules/istanbul-lib-coverage": {"version": "3.2.0","resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz",@@ -26347,7 +26435,6 @@"version": "5.0.1","resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz","integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==",- "dev": true,"license": "ISC"},"node_modules/json5": {@@ -28076,6 +28163,19 @@"set-blocking": "^2.0.0"}},+ "node_modules/ntlm-client": {+ "version": "0.1.1",+ "resolved": "https://registry.npmjs.org/ntlm-client/-/ntlm-client-0.1.1.tgz",+ "integrity": "sha512-BQVZp+qB0i6CyWyzAKKcMBmiC9g18gbDcFaXU6Qp0Qygc9S4r9A9XawMTSbX0+kw3mvQjYVxs93l1IDjyEfb1w==",+ "license": "MIT",+ "dependencies": {+ "extend": "^3.0.0",+ "request": "^2.66.0"+ },+ "engines": {+ "node": ">=4.0.0"+ }+ },"node_modules/nwsapi": {"version": "2.2.18","resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.18.tgz",@@ -28119,6 +28219,15 @@"integrity": "sha512-JtFnB+8nxDEXgNyniwz573xxbKSOu3R8D40xQKqcjwJ2CDkYqUDI53o6IuzDJBx60Z8VKCm271+t8iFjakrl8Q==","license": "MIT"},+ "node_modules/oauth-sign": {+ "version": "0.9.0",+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",+ "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",+ "license": "Apache-2.0",+ "engines": {+ "node": "*"+ }+ },"node_modules/oauth4webapi": {"version": "3.8.3","resolved": "https://registry.npmjs.org/oauth4webapi/-/oauth4webapi-3.8.3.tgz",@@ -30740,6 +30849,12 @@"url": "https://ko-fi.com/killymxi"}},+ "node_modules/performance-now": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",+ "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==",+ "license": "MIT"+ },"node_modules/pg": {"version": "8.13.1","resolved": "https://registry.npmjs.org/pg/-/pg-8.13.1.tgz",@@ -31642,6 +31757,18 @@"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz","integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="},+ "node_modules/psl": {+ "version": "1.15.0",+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.15.0.tgz",+ "integrity": "sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==",+ "license": "MIT",+ "dependencies": {+ "punycode": "^2.3.1"+ },+ "funding": {+ "url": "https://github.com/sponsors/lupomontero"+ }+ },"node_modules/pstree.remy": {"version": "1.1.8","resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",@@ -32376,6 +32503,90 @@"jsesc": "bin/jsesc"}},+ "node_modules/request": {+ "version": "2.88.2",+ "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",+ "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",+ "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",+ "license": "Apache-2.0",+ "dependencies": {+ "aws-sign2": "~0.7.0",+ "aws4": "^1.8.0",+ "caseless": "~0.12.0",+ "combined-stream": "~1.0.6",+ "extend": "~3.0.2",+ "forever-agent": "~0.6.1",+ "form-data": "~2.3.2",+ "har-validator": "~5.1.3",+ "http-signature": "~1.2.0",+ "is-typedarray": "~1.0.0",+ "isstream": "~0.1.2",+ "json-stringify-safe": "~5.0.1",+ "mime-types": "~2.1.19",+ "oauth-sign": "~0.9.0",+ "performance-now": "^2.1.0",+ "qs": "~6.5.2",+ "safe-buffer": "^5.1.2",+ "tough-cookie": "~2.5.0",+ "tunnel-agent": "^0.6.0",+ "uuid": "^3.3.2"+ },+ "engines": {+ "node": ">= 6"+ }+ },+ "node_modules/request/node_modules/form-data": {+ "version": "2.3.3",+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",+ "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",+ "license": "MIT",+ "dependencies": {+ "asynckit": "^0.4.0",+ "combined-stream": "^1.0.6",+ "mime-types": "^2.1.12"+ },+ "engines": {+ "node": ">= 0.12"+ }+ },+ "node_modules/request/node_modules/http-signature": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",+ "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",+ "license": "MIT",+ "dependencies": {+ "assert-plus": "^1.0.0",+ "jsprim": "^1.2.2",+ "sshpk": "^1.7.0"+ },+ "engines": {+ "node": ">=0.8",+ "npm": ">=1.3.7"+ }+ },+ "node_modules/request/node_modules/tough-cookie": {+ "version": "2.5.0",+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",+ "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "psl": "^1.1.28",+ "punycode": "^2.1.1"+ },+ "engines": {+ "node": ">=0.8"+ }+ },+ "node_modules/request/node_modules/uuid": {+ "version": "3.4.0",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",+ "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",+ "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",+ "license": "MIT",+ "bin": {+ "uuid": "bin/uuid"+ }+ },"node_modules/require-directory": {"version": "2.1.1","resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",@@ -35936,6 +36147,18 @@"node": ">=0.6.11 <=0.7.0 || >=0.7.3"}},+ "node_modules/tunnel-agent": {+ "version": "0.6.0",+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",+ "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",+ "license": "Apache-2.0",+ "dependencies": {+ "safe-buffer": "^5.0.1"+ },+ "engines": {+ "node": "*"+ }+ },"node_modules/tweetnacl": {"version": "1.0.3","resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",@@ -36929,6 +37152,34 @@"node": ">=8"}},+ "node_modules/winrm-client": {+ "version": "0.0.11",+ "resolved": "https://registry.npmjs.org/winrm-client/-/winrm-client-0.0.11.tgz",+ "integrity": "sha512-uAEHicMbXuPsnxII96Y21rpFqgRYjZfEzckYZwgqSZZQPT97fwDCNopCNlEreWK4yyexTtJpTx0xtOoaEB1Slg==",+ "license": "MIT",+ "dependencies": {+ "fast-xml-parser": "^4.3.2",+ "js-md4": "^0.3.2",+ "ntlm-client": "^0.1.1",+ "uuid": "^11.1.0"+ },+ "engines": {+ "node": ">=16.0.0"+ }+ },+ "node_modules/winrm-client/node_modules/uuid": {+ "version": "11.1.0",+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",+ "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",+ "funding": [+ "https://github.com/sponsors/broofa",+ "https://github.com/sponsors/ctavan"+ ],+ "license": "MIT",+ "bin": {+ "uuid": "dist/esm/bin/uuid"+ }+ },"node_modules/winston": {"version": "3.15.0","resolved": "https://registry.npmjs.org/winston/-/winston-3.15.0.tgz",diff --git a/backend/package.json b/backend/package.jsonindex a498d3c295..6ec81c9cd2 100644--- a/backend/package.json+++ b/backend/package.json@@ -79,6 +79,7 @@"@react-email/preview-server": "^5.0.6","@smithy/types": "^4.3.1","@types/bcrypt": "^5.0.2",+ "@types/dns-packet": "^5.6.5","@types/jmespath": "^0.15.2","@types/js-yaml": "^4.0.9","@types/jsonwebtoken": "^9.0.5",@@ -195,6 +196,7 @@"connect-redis": "^7.1.1","cron": "^3.1.7","dd-trace": "^5.40.0",+ "dns-packet": "^5.6.1","dotenv": "^16.4.1","fastify": "^4.29.1","fastify-plugin": "^4.5.1",@@ -259,6 +261,7 @@"tweetnacl": "^1.0.3","tweetnacl-util": "^0.15.1","uuid": "^9.0.1",+ "winrm-client": "^0.0.11","zod": "^3.22.4","zod-to-json-schema": "^3.24.5"}diff --git a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.tsindex 7bcc8a0af3..89170af31c 100644--- a/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts+++ b/backend/src/ee/services/pam-discovery/active-directory/active-directory-discovery-factory.ts@@ -1,6 +1,10 @@+import net from "node:net";++import * as dnsPacket from "dns-packet";import { Knex } from "knex";import ldapjs from "ldapjs";import RE2 from "re2";+import { runPowershell } from "winrm-client";import { TPamDiscoveryScanDeps } from "@app/ee/services/pam-discovery/pam-discovery-factory";import { BadRequestError } from "@app/lib/errors";@@ -21,8 +25,10 @@ import {import { TPamResourceDALFactory } from "../../pam-resource/pam-resource-dal";import { PamResource } from "../../pam-resource/pam-resource-enums";import { encryptResourceConnectionDetails, encryptResourceInternalMetadata } from "../../pam-resource/pam-resource-fns";-import { WindowsProtocol } from "../../pam-resource/windows-server/windows-server-resource-enums";+import { WindowsAccountType, WindowsProtocol } from "../../pam-resource/windows-server/windows-server-resource-enums";import {+ TWindowsAccountCredentials,+ TWindowsAccountMetadata,TWindowsResourceConnectionDetails,TWindowsResourceInternalMetadata} from "../../pam-resource/windows-server/windows-server-resource-types";@@ -40,8 +46,18 @@ import {const LDAP_TIMEOUT = 30 * 1000;const LDAP_PAGE_SIZE = 500;+const WINRM_PORT = 5985;const SERVICE_ACCOUNT_PATTERNS = [new RE2(/^svc[_-]/i), new RE2(/[_-]service$/i), new RE2(/[_-]svc$/i)];+type TWinRmLocalUser = {+ Name: string;+ Enabled: boolean;+ LastLogon: string | null;+ PasswordLastSet: string | null;+ Description: string;+ SID: { Value: string };+};+type TLdapComputer = {cn: string;dNSHostName: string;@@ -49,6 +65,7 @@ type TLdapComputer = {operatingSystemVersion: string;objectGUID: string;whenChanged: string;+ resolvedIp?: string;};type TLdapUser = {@@ -187,6 +204,85 @@ const executeWithGateway = async <T>();};+// Resolve a single hostname to an IP via DNS-over-TCP through the gateway proxy+const resolveDnsTcp = (hostname: string, port: number): Promise<string | null> => {+ return new Promise((resolve) => {+ const query = dnsPacket.streamEncode({+ type: "query",+ flags: dnsPacket.RECURSION_DESIRED,+ questions: [{ type: "A", name: hostname }]+ });++ const socket = net.connect({ host: "127.0.0.1", port }, () => {+ socket.write(query);+ });++ let responseData = Buffer.alloc(0);++ socket.on("data", (chunk: Buffer) => {+ responseData = Buffer.concat([responseData, chunk]);++ // DNS-over-TCP frames each message with a 2-byte big-endian length prefix+ // wait until we have the full frame before decoding+ if (responseData.length >= 2) {+ const msgLen = responseData.readUInt16BE(0);+ if (responseData.length >= 2 + msgLen) {+ const response = dnsPacket.streamDecode(responseData);+ const aRecord = response.answers?.find((a) => a.type === "A");+ socket.destroy();+ resolve(aRecord && "data" in aRecord ? (aRecord.data as string) : null);+ }+ }+ });++ socket.on("error", () => {+ resolve(null);+ });++ socket.setTimeout(5000, () => {+ socket.destroy();+ resolve(null);+ });+ });+};++// Resolve AD hostnames to IP addresses by querying DNS over TCP through the DC+const resolveHostnamesViaDc = async (+ computers: TLdapComputer[],+ configuration: TAdDiscoveryConfiguration,+ gatewayId: string,+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">+): Promise<void> => {+ await executeWithGateway(+ { dcAddress: configuration.dcAddress, port: 53, gatewayId },+ gatewayV2Service,+ async (proxyPort) => {+ // Resolve each hostname sequentially to avoid overwhelming the proxy+ // eslint-disable-next-line no-await-in-loop+ for (const computer of computers) {+ const hostname = computer.dNSHostName || computer.cn;+ if (!hostname) {+ // skip computers without a hostname+ } else if (net.isIP(hostname)) {+ computer.resolvedIp = hostname;+ } else {+ try {+ // eslint-disable-next-line no-await-in-loop+ const ip = await resolveDnsTcp(hostname, proxyPort);+ if (ip) {+ computer.resolvedIp = ip;+ } else {+ logger.warn({ hostname }, "DNS resolution returned no A records");+ }+ } catch (err) {+ logger.warn({ hostname, err: (err as Error).message }, "Failed to resolve hostname via DC DNS");+ }+ }+ }+ }+ );+};+type TLdapAttribute = { type: string; values: string[]; buffers: Buffer[] };const getAttr = (entry: ldapjs.SearchEntry, attrName: string): string => {@@ -474,6 +570,90 @@ const upsertDomainAccount = async (return { account, isNew: true };};+const executeWinRmLocalAccountEnumeration = async (+ computer: TLdapComputer,+ domainFQDN: string,+ credentials: TAdDiscoveryCredentials,+ gatewayId: string,+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">+): Promise<TWinRmLocalUser[]> => {+ const hostname = computer.dNSHostName || computer.cn;+ const targetAddress = computer.resolvedIp || hostname;++ return executeWithGateway(+ { dcAddress: targetAddress, port: WINRM_PORT, gatewayId },+ gatewayV2Service,+ async (proxyPort) => {+ logger.info({ hostname, targetAddress, proxyPort, domain: domainFQDN }, "WinRM: Enumerating local accounts");++ const netbiosDomain = domainFQDN.split(".")[0].toUpperCase();+ const winrmUsername = `${netbiosDomain}\\${credentials.username}`;+ const script = `Get-LocalUser | Select-Object Name, Enabled, LastLogon, PasswordLastSet, Description, SID | ConvertTo-Json`;+ const stdout = await runPowershell(script, "localhost", winrmUsername, credentials.password, proxyPort);++ if (!stdout.trim()) {+ return [];+ }++ const parsed = JSON.parse(stdout) as TWinRmLocalUser | TWinRmLocalUser[];+ return Array.isArray(parsed) ? parsed : [parsed];+ }+ );+};++const upsertLocalAccount = async (+ projectId: string,+ localUser: TWinRmLocalUser,+ computerObjectGUID: string,+ windowsServerResourceId: string,+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">,+ pamAccountDAL: Pick<TPamAccountDALFactory, "create" | "find">,+ tx: Knex+) => {+ const fingerprint = `${computerObjectGUID}:${localUser.Name.toLowerCase()}`;++ const existing = await pamAccountDAL.find(+ {+ resourceId: windowsServerResourceId,+ discoveryFingerprint: fingerprint+ },+ { tx }+ );++ if (existing.length > 0) {+ return { account: existing[0], isNew: false };+ }++ const accountName = toSlugName(localUser.Name);++ const encryptedCredentials = await encryptAccountCredentials({+ projectId,+ credentials: {+ username: localUser.Name,+ password: ""+ } as TWindowsAccountCredentials,+ kmsService+ });++ const internalMetadata = {+ accountType: WindowsAccountType.User+ } as TWindowsAccountMetadata;++ const account = await pamAccountDAL.create(+ {+ projectId,+ resourceId: windowsServerResourceId,+ name: accountName,+ encryptedCredentials,+ internalMetadata,+ discoveryFingerprint: fingerprint+ },+ tx+ );++ return { account, isNew: true };+};+export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<TAdDiscoveryConfiguration,TAdDiscoveryCredentials@@ -558,12 +738,21 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<adEnumerationSucceeded = true;+ // Resolve computer hostnames to IPs via DC DNS so the gateway can reach them+ try {+ await resolveHostnamesViaDc(computers, configuration, gatewayId, gatewayV2Service);+ } catch (err) {+ logger.warn({ err }, "Failed to resolve hostnames via DC DNS, will use hostnames directly");+ }+await pamDiscoveryRunDAL.updateById(run.id, {progress: {adEnumeration: { status: PamDiscoveryStepStatus.Completed, completedAt: new Date().toISOString() },dependencyScan: {- status: PamDiscoveryStepStatus.Skipped,- statusMessage: "WinRM scanning not yet implemented"+ status: PamDiscoveryStepStatus.Running,+ totalMachines: computers.length,+ scannedMachines: 0,+ failedMachines: 0}} as TActiveDirectoryDiscoverySourceRunProgress});@@ -593,10 +782,12 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<resourcesDiscoveredCount += 1;if (isAdServerNew) newResourcesCount += 1;- // Auto-import Windows Server resources+ // Auto-import Windows Server resources and build mapping for local account discovery+ const computerResourceMap = new Map<string, string>(); // objectGUID -> resourceId+for await (const computer of computers) {try {- const { isNew } = await pamResourceDAL.transaction(async (tx) => {+ const { resource: windowsResource, isNew } = await pamResourceDAL.transaction(async (tx) => {const result = await upsertWindowsServerResource(projectId,computer,@@ -619,6 +810,7 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<return result;});+ computerResourceMap.set(computer.objectGUID, windowsResource.id);resourcesDiscoveredCount += 1;if (isNew) newResourcesCount += 1;} catch (err) {@@ -663,12 +855,98 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<}}+ // WinRM local account discovery+ let scannedMachines = 0;+ let failedMachines = 0;+ const machineErrors: Record<string, string> = {};++ // eslint-disable-next-line no-await-in-loop+ for (const computer of computers) {+ const windowsResourceId = computerResourceMap.get(computer.objectGUID);+ if (!windowsResourceId) {+ failedMachines += 1;+ } else {+ const hostname = computer.dNSHostName || computer.cn;++ try {+ // eslint-disable-next-line no-await-in-loop+ const localUsers = await executeWinRmLocalAccountEnumeration(+ computer,+ configuration.domainFQDN,+ credentials,+ gatewayId,+ gatewayV2Service+ );++ for (const localUser of localUsers) {+ try {+ // eslint-disable-next-line no-await-in-loop+ const { isNew } = await pamAccountDAL.transaction(async (tx) => {+ const result = await upsertLocalAccount(+ projectId,+ localUser,+ computer.objectGUID,+ windowsResourceId,+ kmsService,+ pamAccountDAL,+ tx+ );++ await pamDiscoverySourceAccountsDAL.upsertJunction(+ {+ discoverySourceId,+ accountId: result.account.id,+ lastDiscoveredRunId: run.id+ },+ tx+ );++ return result;+ });++ accountsDiscoveredCount += 1;+ if (isNew) newAccountsCount += 1;+ } catch (err) {+ logger.warn({ err, localUser: localUser.Name, computer: hostname }, "Failed to import local account");+ }+ }++ scannedMachines += 1;+ } catch (err) {+ failedMachines += 1;+ machineErrors[hostname] = (err as Error).message;+ logger.warn({ err, computer: hostname }, "WinRM local account enumeration failed for machine");+ }+ }++ // Update progress periodically+ // eslint-disable-next-line no-await-in-loop+ await pamDiscoveryRunDAL.updateById(run.id, {+ accountsDiscoveredCount,+ progress: {+ adEnumeration: { status: PamDiscoveryStepStatus.Completed, completedAt: new Date().toISOString() },+ dependencyScan: {+ status: PamDiscoveryStepStatus.Running,+ totalMachines: computers.length,+ scannedMachines,+ failedMachines+ },+ machineErrors: Object.keys(machineErrors).length > 0 ? machineErrors : undefined+ } as TActiveDirectoryDiscoverySourceRunProgress+ });+ }+if (adEnumerationSucceeded) {const staleResourcesCount =(await pamDiscoverySourceResourcesDAL.markStaleForRun(discoverySourceId, run.id)) || 0;const staleAccountsCount =(await pamDiscoverySourceAccountsDAL.markStaleForRun(discoverySourceId, run.id)) || 0;+ const dependencyScanStatus =+ failedMachines === computers.length && computers.length > 0+ ? PamDiscoveryStepStatus.Failed+ : PamDiscoveryStepStatus.Completed;+await pamDiscoveryRunDAL.updateById(run.id, {status: PamDiscoverySourceRunStatus.Completed,resourcesDiscoveredCount,@@ -680,7 +958,21 @@ export const activeDirectoryDiscoveryFactory: TPamDiscoveryFactory<staleAccountsCount,newDependenciesCount: 0,staleDependenciesCount: 0,- completedAt: new Date()+ completedAt: new Date(),+ progress: {+ adEnumeration: { status: PamDiscoveryStepStatus.Completed, completedAt: new Date().toISOString() },+ dependencyScan: {+ status: dependencyScanStatus,+ totalMachines: computers.length,+ scannedMachines,+ failedMachines,+ statusMessage:+ failedMachines > 0+ ? `${failedMachines} of ${computers.length} machines failed local account enumeration`+ : undefined+ },+ machineErrors: Object.keys(machineErrors).length > 0 ? machineErrors : undefined+ } as TActiveDirectoryDiscoverySourceRunProgress});}} catch (error) {diff --git a/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx b/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsxindex 038051786f..574d46111c 100644--- a/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx+++ b/frontend/src/pages/pam/PamDiscoveryDetailPage/PamDiscoveryDetailPage.tsx@@ -52,6 +52,7 @@ import { ProjectPermissionSub, useOrganization } from "@app/context";import { ProjectPermissionPamDiscoveryActions } from "@app/context/ProjectPermissionContext/types";import { usePagination } from "@app/hooks";import { gatewaysQueryKeys } from "@app/hooks/api";+import { PamResourceType } from "@app/hooks/api/pam";import type {PamDiscoveryType,TPamDiscoverySource,@@ -303,6 +304,11 @@ const RunExpandedContent = ({<span className="text-xs font-medium tracking-wider text-muted uppercase">Machine Errors</span>+ <div className="mb-0.5 flex items-start gap-2 rounded border border-yellow-500/30 bg-yellow-500/10 px-3 py-2 text-xs text-yellow-400">+ <InfoIcon className="mt-0.5 size-3.5 shrink-0" />+ Machines without WinRM enabled will fail with "socket hang up". This is+ expected for domain controllers and machines not configured for remote management.+ </div><div className="flex flex-col gap-1">{Object.entries(machineErrors).map(([host, err]) => (<div@@ -724,8 +730,15 @@ const AccountsTab = ({><UnstableTableCell className="font-medium">{account.accountName}</UnstableTableCell><UnstableTableCell className="text-muted">{account.resourceName}</UnstableTableCell>- <UnstableTableCell className="text-muted capitalize">- {account.internalMetadata?.accountType ?? "-"}+ <UnstableTableCell>+ <div className="flex items-center gap-2">+ {account.resourceType === PamResourceType.ActiveDirectory && (+ <Badge variant="info">AD</Badge>+ )}+ <span className="text-muted capitalize">+ {account.internalMetadata?.accountType ?? "-"}+ </span>+ </div></UnstableTableCell><UnstableTableCell className="text-muted">{formatWindowsFileTime(account.internalMetadata?.lastLogonTimestamp)}