mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-08 23:28:25 +00:00
Fix merge conflicts
This commit is contained in:
Generated
+118
-83
@@ -9,17 +9,17 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-secrets-manager": "^3.502.0",
|
"@aws-sdk/client-secrets-manager": "^3.504.0",
|
||||||
"@casl/ability": "^6.5.0",
|
"@casl/ability": "^6.5.0",
|
||||||
"@fastify/cookie": "^9.2.0",
|
"@fastify/cookie": "^9.2.0",
|
||||||
"@fastify/cors": "^8.4.1",
|
"@fastify/cors": "^8.5.0",
|
||||||
"@fastify/etag": "^5.1.0",
|
"@fastify/etag": "^5.1.0",
|
||||||
"@fastify/formbody": "^7.4.0",
|
"@fastify/formbody": "^7.4.0",
|
||||||
"@fastify/helmet": "^11.1.1",
|
"@fastify/helmet": "^11.1.1",
|
||||||
"@fastify/passport": "^2.4.0",
|
"@fastify/passport": "^2.4.0",
|
||||||
"@fastify/rate-limit": "^9.0.0",
|
"@fastify/rate-limit": "^9.0.0",
|
||||||
"@fastify/session": "^10.7.0",
|
"@fastify/session": "^10.7.0",
|
||||||
"@fastify/swagger": "^8.12.0",
|
"@fastify/swagger": "^8.14.0",
|
||||||
"@fastify/swagger-ui": "^2.1.0",
|
"@fastify/swagger-ui": "^2.1.0",
|
||||||
"@node-saml/passport-saml": "^4.0.4",
|
"@node-saml/passport-saml": "^4.0.4",
|
||||||
"@octokit/rest": "^20.0.2",
|
"@octokit/rest": "^20.0.2",
|
||||||
@@ -30,12 +30,12 @@
|
|||||||
"ajv": "^8.12.0",
|
"ajv": "^8.12.0",
|
||||||
"argon2": "^0.31.2",
|
"argon2": "^0.31.2",
|
||||||
"aws-sdk": "^2.1545.0",
|
"aws-sdk": "^2.1545.0",
|
||||||
"axios": "^1.6.4",
|
"axios": "^1.6.7",
|
||||||
"axios-retry": "^4.0.0",
|
"axios-retry": "^4.0.0",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"bullmq": "^5.1.1",
|
"bullmq": "^5.1.6",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.1",
|
||||||
"fastify": "^4.24.3",
|
"fastify": "^4.26.0",
|
||||||
"fastify-plugin": "^4.5.1",
|
"fastify-plugin": "^4.5.1",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
"ioredis": "^5.3.2",
|
"ioredis": "^5.3.2",
|
||||||
@@ -45,7 +45,7 @@
|
|||||||
"knex": "^3.0.1",
|
"knex": "^3.0.1",
|
||||||
"libsodium-wrappers": "^0.7.13",
|
"libsodium-wrappers": "^0.7.13",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"mysql2": "^3.6.5",
|
"mysql2": "^3.9.1",
|
||||||
"nanoid": "^5.0.4",
|
"nanoid": "^5.0.4",
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"nodemailer": "^6.9.9",
|
"nodemailer": "^6.9.9",
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
"tweetnacl-util": "^0.15.1",
|
"tweetnacl-util": "^0.15.1",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
"zod": "^3.22.4",
|
"zod": "^3.22.4",
|
||||||
"zod-to-json-schema": "^3.22.0"
|
"zod-to-json-schema": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/bcrypt": "^5.0.2",
|
"@types/bcrypt": "^5.0.2",
|
||||||
@@ -662,15 +662,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/client-secrets-manager": {
|
"node_modules/@aws-sdk/client-secrets-manager": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/client-secrets-manager/-/client-secrets-manager-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/client-secrets-manager/-/client-secrets-manager-3.504.0.tgz",
|
||||||
"integrity": "sha512-ICU084A/EbYMqca6NVFqeMtHh+KCdn0H7UjARUy5ur1yOlXXvxqAJGtKZDYFjuEO08F30zbv7+4HCOy6yjOJ0Q==",
|
"integrity": "sha512-JPwsYfQMjs5t74JmA4r1AjpiOG/LEw74d4a8vEdSy3pe2lhl/sSsxSdQtbI30wlJJramngtLNZjxn2+BGDphbg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-crypto/sha256-browser": "3.0.0",
|
"@aws-crypto/sha256-browser": "3.0.0",
|
||||||
"@aws-crypto/sha256-js": "3.0.0",
|
"@aws-crypto/sha256-js": "3.0.0",
|
||||||
"@aws-sdk/client-sts": "3.502.0",
|
"@aws-sdk/client-sts": "3.504.0",
|
||||||
"@aws-sdk/core": "3.496.0",
|
"@aws-sdk/core": "3.496.0",
|
||||||
"@aws-sdk/credential-provider-node": "3.502.0",
|
"@aws-sdk/credential-provider-node": "3.504.0",
|
||||||
"@aws-sdk/middleware-host-header": "3.502.0",
|
"@aws-sdk/middleware-host-header": "3.502.0",
|
||||||
"@aws-sdk/middleware-logger": "3.502.0",
|
"@aws-sdk/middleware-logger": "3.502.0",
|
||||||
"@aws-sdk/middleware-recursion-detection": "3.502.0",
|
"@aws-sdk/middleware-recursion-detection": "3.502.0",
|
||||||
@@ -768,13 +768,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/client-sso-oidc": {
|
"node_modules/@aws-sdk/client-sso-oidc": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.504.0.tgz",
|
||||||
"integrity": "sha512-Yc9tZqTOMWtdgpkrdjKShgWb9oKNsFQrItfoiN1xWDllaFFRPi2KTiZiR0AbSTrNasJy13d210DOxrIdte+kWQ==",
|
"integrity": "sha512-ODA33/nm2srhV08EW0KZAP577UgV0qjyr7Xp2yEo8MXWL4ZqQZprk1c+QKBhjr4Djesrm0VPmSD/np0mtYP68A==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-crypto/sha256-browser": "3.0.0",
|
"@aws-crypto/sha256-browser": "3.0.0",
|
||||||
"@aws-crypto/sha256-js": "3.0.0",
|
"@aws-crypto/sha256-js": "3.0.0",
|
||||||
"@aws-sdk/client-sts": "3.502.0",
|
"@aws-sdk/client-sts": "3.504.0",
|
||||||
"@aws-sdk/core": "3.496.0",
|
"@aws-sdk/core": "3.496.0",
|
||||||
"@aws-sdk/middleware-host-header": "3.502.0",
|
"@aws-sdk/middleware-host-header": "3.502.0",
|
||||||
"@aws-sdk/middleware-logger": "3.502.0",
|
"@aws-sdk/middleware-logger": "3.502.0",
|
||||||
@@ -816,13 +816,13 @@
|
|||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@aws-sdk/credential-provider-node": "*"
|
"@aws-sdk/credential-provider-node": "^3.504.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/client-sts": {
|
"node_modules/@aws-sdk/client-sts": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.504.0.tgz",
|
||||||
"integrity": "sha512-0q08gsvn6nuRqjK+i/e30PT/t7vvYwmGJS0PhJikZWv5yRDNSUxSYG0uDwKSbLDzmc2UX5+mLeyjPHlL4hbGlA==",
|
"integrity": "sha512-IESs8FkL7B/uY+ml4wgoRkrr6xYo4PizcNw6JX17eveq1gRBCPKeGMjE6HTDOcIYZZ8rqz/UeuH3JD4UhrMOnA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-crypto/sha256-browser": "3.0.0",
|
"@aws-crypto/sha256-browser": "3.0.0",
|
||||||
"@aws-crypto/sha256-js": "3.0.0",
|
"@aws-crypto/sha256-js": "3.0.0",
|
||||||
@@ -868,7 +868,7 @@
|
|||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@aws-sdk/credential-provider-node": "*"
|
"@aws-sdk/credential-provider-node": "^3.504.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/core": {
|
"node_modules/@aws-sdk/core": {
|
||||||
@@ -901,16 +901,35 @@
|
|||||||
"node": ">=14.0.0"
|
"node": ">=14.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/credential-provider-ini": {
|
"node_modules/@aws-sdk/credential-provider-http": {
|
||||||
"version": "3.502.0",
|
"version": "3.503.1",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.503.1.tgz",
|
||||||
"integrity": "sha512-1wB/escbspUY6uRDEMp9AMMyypUSyuQ0AMO1yQNtXviV8cPf+CuRbqP/UVnimHO1RuX0n5BmjDVVjUIEU6kuGA==",
|
"integrity": "sha512-rTdlFFGoPPFMF2YjtlfRuSgKI+XsF49u7d98255hySwhsbwd3Xp+utTTPquxP+CwDxMHbDlI7NxDzFiFdsoZug==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sts": "3.502.0",
|
"@aws-sdk/types": "3.502.0",
|
||||||
|
"@smithy/fetch-http-handler": "^2.4.1",
|
||||||
|
"@smithy/node-http-handler": "^2.3.1",
|
||||||
|
"@smithy/property-provider": "^2.1.1",
|
||||||
|
"@smithy/protocol-http": "^3.1.1",
|
||||||
|
"@smithy/smithy-client": "^2.3.1",
|
||||||
|
"@smithy/types": "^2.9.1",
|
||||||
|
"@smithy/util-stream": "^2.1.1",
|
||||||
|
"tslib": "^2.5.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@aws-sdk/credential-provider-ini": {
|
||||||
|
"version": "3.504.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.504.0.tgz",
|
||||||
|
"integrity": "sha512-ODICLXfr8xTUd3wweprH32Ge41yuBa+u3j0JUcLdTUO1N9ldczSMdo8zOPlP0z4doqD3xbnqMkjNQWgN/Q+5oQ==",
|
||||||
|
"dependencies": {
|
||||||
|
"@aws-sdk/client-sts": "3.504.0",
|
||||||
"@aws-sdk/credential-provider-env": "3.502.0",
|
"@aws-sdk/credential-provider-env": "3.502.0",
|
||||||
"@aws-sdk/credential-provider-process": "3.502.0",
|
"@aws-sdk/credential-provider-process": "3.502.0",
|
||||||
"@aws-sdk/credential-provider-sso": "3.502.0",
|
"@aws-sdk/credential-provider-sso": "3.504.0",
|
||||||
"@aws-sdk/credential-provider-web-identity": "3.502.0",
|
"@aws-sdk/credential-provider-web-identity": "3.504.0",
|
||||||
"@aws-sdk/types": "3.502.0",
|
"@aws-sdk/types": "3.502.0",
|
||||||
"@smithy/credential-provider-imds": "^2.2.1",
|
"@smithy/credential-provider-imds": "^2.2.1",
|
||||||
"@smithy/property-provider": "^2.1.1",
|
"@smithy/property-provider": "^2.1.1",
|
||||||
@@ -923,15 +942,16 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/credential-provider-node": {
|
"node_modules/@aws-sdk/credential-provider-node": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.504.0.tgz",
|
||||||
"integrity": "sha512-qg71UpYeFrjhu5hD+vdRqZ+EYFB11BeszsbfEJGaHhOMHmmTHNBaDAexW+bUnJSXcJL0a8vniCvca+rElbcAHQ==",
|
"integrity": "sha512-6+V5hIh+tILmUjf2ZQWQINR3atxQVgH/bFrGdSR/sHSp/tEgw3m0xWL3IRslWU1e4/GtXrfg1iYnMknXy68Ikw==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/credential-provider-env": "3.502.0",
|
"@aws-sdk/credential-provider-env": "3.502.0",
|
||||||
"@aws-sdk/credential-provider-ini": "3.502.0",
|
"@aws-sdk/credential-provider-http": "3.503.1",
|
||||||
|
"@aws-sdk/credential-provider-ini": "3.504.0",
|
||||||
"@aws-sdk/credential-provider-process": "3.502.0",
|
"@aws-sdk/credential-provider-process": "3.502.0",
|
||||||
"@aws-sdk/credential-provider-sso": "3.502.0",
|
"@aws-sdk/credential-provider-sso": "3.504.0",
|
||||||
"@aws-sdk/credential-provider-web-identity": "3.502.0",
|
"@aws-sdk/credential-provider-web-identity": "3.504.0",
|
||||||
"@aws-sdk/types": "3.502.0",
|
"@aws-sdk/types": "3.502.0",
|
||||||
"@smithy/credential-provider-imds": "^2.2.1",
|
"@smithy/credential-provider-imds": "^2.2.1",
|
||||||
"@smithy/property-provider": "^2.1.1",
|
"@smithy/property-provider": "^2.1.1",
|
||||||
@@ -959,12 +979,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/credential-provider-sso": {
|
"node_modules/@aws-sdk/credential-provider-sso": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.504.0.tgz",
|
||||||
"integrity": "sha512-/2Nyvo+cWQpH283lmZBimTJ9JDhES9FzQUkhUXZgxQo3Ez4sguLVi2V9xoFFyG0cMff5fuNivdKHfj4FeMGjZw==",
|
"integrity": "sha512-4MgH2or2SjPzaxM08DCW+BjaX4DSsEGJlicHKmz6fh+w9JmLh750oXcTnbvgUeVz075jcs6qTKjvUcsdGM/t8Q==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sso": "3.502.0",
|
"@aws-sdk/client-sso": "3.502.0",
|
||||||
"@aws-sdk/token-providers": "3.502.0",
|
"@aws-sdk/token-providers": "3.504.0",
|
||||||
"@aws-sdk/types": "3.502.0",
|
"@aws-sdk/types": "3.502.0",
|
||||||
"@smithy/property-provider": "^2.1.1",
|
"@smithy/property-provider": "^2.1.1",
|
||||||
"@smithy/shared-ini-file-loader": "^2.3.1",
|
"@smithy/shared-ini-file-loader": "^2.3.1",
|
||||||
@@ -976,11 +996,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/credential-provider-web-identity": {
|
"node_modules/@aws-sdk/credential-provider-web-identity": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.504.0.tgz",
|
||||||
"integrity": "sha512-veBAjDqjMMgA2Qxxf9ywDfHYLeJpaeHWLWCQ9XCHwJJ6ZIGWmAZPTq3he/UMr5JIQXooIccqqyqXMDIXPenXpA==",
|
"integrity": "sha512-L1ljCvGpIEFdJk087ijf2ohg7HBclOeB1UgBxUBBzf4iPRZTQzd2chGaKj0hm2VVaXz7nglswJeURH5PFcS5oA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sts": "3.502.0",
|
"@aws-sdk/client-sts": "3.504.0",
|
||||||
"@aws-sdk/types": "3.502.0",
|
"@aws-sdk/types": "3.502.0",
|
||||||
"@smithy/property-provider": "^2.1.1",
|
"@smithy/property-provider": "^2.1.1",
|
||||||
"@smithy/types": "^2.9.1",
|
"@smithy/types": "^2.9.1",
|
||||||
@@ -1080,11 +1100,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aws-sdk/token-providers": {
|
"node_modules/@aws-sdk/token-providers": {
|
||||||
"version": "3.502.0",
|
"version": "3.504.0",
|
||||||
"resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.502.0.tgz",
|
"resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.504.0.tgz",
|
||||||
"integrity": "sha512-RQgMgIXYlSf0xGl6EUeD+pqIPBlb7e29dbqHOBFc66hJVYUC2ULZX7Y+jLvcGIEaMiIaTPyvntZRFip+U+9hag==",
|
"integrity": "sha512-YIJWWsZi2ClUiILS1uh5L6VjmCUSTI6KKMuL9DkGjYqJ0aI6M8bd8fT9Wm7QmXCyjcArTgr/Atkhia4T7oKvzQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-sso-oidc": "3.502.0",
|
"@aws-sdk/client-sso-oidc": "3.504.0",
|
||||||
"@aws-sdk/types": "3.502.0",
|
"@aws-sdk/types": "3.502.0",
|
||||||
"@smithy/property-provider": "^2.1.1",
|
"@smithy/property-provider": "^2.1.1",
|
||||||
"@smithy/shared-ini-file-loader": "^2.3.1",
|
"@smithy/shared-ini-file-loader": "^2.3.1",
|
||||||
@@ -1677,12 +1697,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/cors": {
|
"node_modules/@fastify/cors": {
|
||||||
"version": "8.4.1",
|
"version": "8.5.0",
|
||||||
"resolved": "https://registry.npmjs.org/@fastify/cors/-/cors-8.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@fastify/cors/-/cors-8.5.0.tgz",
|
||||||
"integrity": "sha512-iYQJtrY3pFiDS5mo5zRaudzg2OcUdJ96PD6xfkKOOEilly5nnrFZx/W6Sce2T79xxlEn2qpU3t5+qS2phS369w==",
|
"integrity": "sha512-/oZ1QSb02XjP0IK1U0IXktEsw/dUBTxJOW7IpIeO8c/tNalw/KjoNSJv1Sf6eqoBPO+TDGkifq6ynFK3v68HFQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fastify-plugin": "^4.0.0",
|
"fastify-plugin": "^4.0.0",
|
||||||
"mnemonist": "0.39.5"
|
"mnemonist": "0.39.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/deepmerge": {
|
"node_modules/@fastify/deepmerge": {
|
||||||
@@ -1791,9 +1811,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/swagger": {
|
"node_modules/@fastify/swagger": {
|
||||||
"version": "8.12.0",
|
"version": "8.14.0",
|
||||||
"resolved": "https://registry.npmjs.org/@fastify/swagger/-/swagger-8.12.0.tgz",
|
"resolved": "https://registry.npmjs.org/@fastify/swagger/-/swagger-8.14.0.tgz",
|
||||||
"integrity": "sha512-IMRc0xYuzRvtFDMuaWHyVbvM7CuAi0g3o2jaVgLDvETXPrXWAMWsHYR5niIdWBDPgGUq+soHkag1DKXyhPDB0w==",
|
"integrity": "sha512-sGiznEb3rl6pKGGUZ+JmfI7ct5cwbTQGo+IjewaTvtzfrshnryu4dZwEsjw0YHABpBA+kCz3kpRaHB7qpa67jg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fastify-plugin": "^4.0.0",
|
"fastify-plugin": "^4.0.0",
|
||||||
"json-schema-resolver": "^2.0.0",
|
"json-schema-resolver": "^2.0.0",
|
||||||
@@ -5275,9 +5295,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.6.4",
|
"version": "1.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.4.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.6.7.tgz",
|
||||||
"integrity": "sha512-heJnIs6N4aa1eSthhN9M5ioILu8Wi8vmQW9iHQ9NUvfkJb0lEEDUiIdQNAuBtfUt3FxReaKdpQA5DbmMOqzF/A==",
|
"integrity": "sha512-/hDJGff6/c7u0hDkvkGxR/oy6CbCs8ziCsC7SqmhjfozqiJGc8Z11wrv9z9lYfY4K8l+H9TpjcMDX0xOZmx+RA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.15.4",
|
"follow-redirects": "^1.15.4",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
@@ -5513,15 +5533,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/bullmq": {
|
"node_modules/bullmq": {
|
||||||
"version": "5.1.1",
|
"version": "5.1.6",
|
||||||
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/bullmq/-/bullmq-5.1.6.tgz",
|
||||||
"integrity": "sha512-j3zbNEQWsyHjpqGWiem2XBfmxAjYcArbwsmGlkM1E9MAVcrqB5hQUsXmyy9gEBAdL+PVotMICr7xTquR4Y2sKQ==",
|
"integrity": "sha512-VkLfig+xm4U3hc4QChzuuAy0NGQ9dfPB8o54hmcZHCX9ofp0Zn6bEY+W3Ytkk76eYwPAgXfywDBlAb2Unjl1Rg==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cron-parser": "^4.6.0",
|
"cron-parser": "^4.6.0",
|
||||||
"glob": "^8.0.3",
|
"glob": "^8.0.3",
|
||||||
"ioredis": "^5.3.2",
|
"ioredis": "^5.3.2",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"msgpackr": "^1.6.2",
|
"msgpackr": "^1.10.1",
|
||||||
"node-abort-controller": "^3.1.1",
|
"node-abort-controller": "^3.1.1",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.5.4",
|
||||||
"tslib": "^2.0.0",
|
"tslib": "^2.0.0",
|
||||||
@@ -6041,9 +6061,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dotenv": {
|
"node_modules/dotenv": {
|
||||||
"version": "16.3.1",
|
"version": "16.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz",
|
||||||
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
|
"integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -7026,9 +7046,19 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/fastify": {
|
"node_modules/fastify": {
|
||||||
"version": "4.24.3",
|
"version": "4.26.0",
|
||||||
"resolved": "https://registry.npmjs.org/fastify/-/fastify-4.24.3.tgz",
|
"resolved": "https://registry.npmjs.org/fastify/-/fastify-4.26.0.tgz",
|
||||||
"integrity": "sha512-6HHJ+R2x2LS3y1PqxnwEIjOTZxFl+8h4kSC/TuDPXtA+v2JnV9yEtOsNSKK1RMD7sIR2y1ZsA4BEFaid/cK5pg==",
|
"integrity": "sha512-Fq/7ziWKc6pYLYLIlCRaqJqEVTIZ5tZYfcW/mDK2AQ9v/sqjGFpj0On0/7hU50kbPVjLO4de+larPA1WwPZSfw==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/fastify"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/fastify"
|
||||||
|
}
|
||||||
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/ajv-compiler": "^3.5.0",
|
"@fastify/ajv-compiler": "^3.5.0",
|
||||||
"@fastify/error": "^3.4.0",
|
"@fastify/error": "^3.4.0",
|
||||||
@@ -7037,10 +7067,10 @@
|
|||||||
"avvio": "^8.2.1",
|
"avvio": "^8.2.1",
|
||||||
"fast-content-type-parse": "^1.1.0",
|
"fast-content-type-parse": "^1.1.0",
|
||||||
"fast-json-stringify": "^5.8.0",
|
"fast-json-stringify": "^5.8.0",
|
||||||
"find-my-way": "^7.7.0",
|
"find-my-way": "^8.0.0",
|
||||||
"light-my-request": "^5.11.0",
|
"light-my-request": "^5.11.0",
|
||||||
"pino": "^8.16.0",
|
"pino": "^8.17.0",
|
||||||
"process-warning": "^2.2.0",
|
"process-warning": "^3.0.0",
|
||||||
"proxy-addr": "^2.0.7",
|
"proxy-addr": "^2.0.7",
|
||||||
"rfdc": "^1.3.0",
|
"rfdc": "^1.3.0",
|
||||||
"secure-json-parse": "^2.7.0",
|
"secure-json-parse": "^2.7.0",
|
||||||
@@ -7053,6 +7083,11 @@
|
|||||||
"resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-4.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/fastify-plugin/-/fastify-plugin-4.5.1.tgz",
|
||||||
"integrity": "sha512-stRHYGeuqpEZTL1Ef0Ovr2ltazUT9g844X5z/zEBFLG8RYlpDiOCIG+ATvYEp+/zmc7sN29mcIMp8gvYplYPIQ=="
|
"integrity": "sha512-stRHYGeuqpEZTL1Ef0Ovr2ltazUT9g844X5z/zEBFLG8RYlpDiOCIG+ATvYEp+/zmc7sN29mcIMp8gvYplYPIQ=="
|
||||||
},
|
},
|
||||||
|
"node_modules/fastify/node_modules/process-warning": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/process-warning/-/process-warning-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-mqn0kFRl0EoqhnL0GQ0veqFHyIN1yig9RHh/InzORTUiZHFRAur+aMtRkELNwGs9aNwKS6tg/An4NYBPGwvtzQ=="
|
||||||
|
},
|
||||||
"node_modules/fastq": {
|
"node_modules/fastq": {
|
||||||
"version": "1.15.0",
|
"version": "1.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz",
|
||||||
@@ -7116,9 +7151,9 @@
|
|||||||
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="
|
||||||
},
|
},
|
||||||
"node_modules/find-my-way": {
|
"node_modules/find-my-way": {
|
||||||
"version": "7.7.0",
|
"version": "8.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-7.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/find-my-way/-/find-my-way-8.1.0.tgz",
|
||||||
"integrity": "sha512-+SrHpvQ52Q6W9f3wJoJBbAQULJuNEEQwBvlvYwACDhBTLOTMiQ0HYWh4+vC3OivGP2ENcTI1oKlFA2OepJNjhQ==",
|
"integrity": "sha512-41QwjCGcVTODUmLLqTMeoHeiozbMXYMAE1CKFiDyi9zVZ2Vjh0yz3MF0WQZoIb+cmzP/XlbFjlF2NtJmvZHznA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
"fast-querystring": "^1.0.0",
|
"fast-querystring": "^1.0.0",
|
||||||
@@ -9154,9 +9189,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mnemonist": {
|
"node_modules/mnemonist": {
|
||||||
"version": "0.39.5",
|
"version": "0.39.6",
|
||||||
"resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.39.5.tgz",
|
"resolved": "https://registry.npmjs.org/mnemonist/-/mnemonist-0.39.6.tgz",
|
||||||
"integrity": "sha512-FPUtkhtJ0efmEFGpU14x7jGbTB+s18LrzRL2KgoWz9YvcY3cPomz8tih01GbHwnGk/OmkOKfqd/RAQoc8Lm7DQ==",
|
"integrity": "sha512-A/0v5Z59y63US00cRSLiloEIw3t5G+MiKz4BhX21FI+YBJXBOGW0ohFxTxO08dsOYlzxo87T7vGfZKYp2bcAWA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"obliterator": "^2.0.1"
|
"obliterator": "^2.0.1"
|
||||||
}
|
}
|
||||||
@@ -9217,9 +9252,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mysql2": {
|
"node_modules/mysql2": {
|
||||||
"version": "3.6.5",
|
"version": "3.9.1",
|
||||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.9.1.tgz",
|
||||||
"integrity": "sha512-pS/KqIb0xlXmtmqEuTvBXTmLoQ5LmAz5NW/r8UyQ1ldvnprNEj3P9GbmuQQ2J0A4LO+ynotGi6TbscPa8OUb+w==",
|
"integrity": "sha512-3njoWAAhGBYy0tWBabqUQcLtczZUxrmmtc2vszQUekg3kTJyZ5/IeLC3Fo04u6y6Iy5Sba7pIIa2P/gs8D3ZeQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"denque": "^2.1.0",
|
"denque": "^2.1.0",
|
||||||
"generate-function": "^2.3.1",
|
"generate-function": "^2.3.1",
|
||||||
@@ -13974,9 +14009,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/zod-to-json-schema": {
|
"node_modules/zod-to-json-schema": {
|
||||||
"version": "3.22.0",
|
"version": "3.22.4",
|
||||||
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.22.0.tgz",
|
"resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.22.4.tgz",
|
||||||
"integrity": "sha512-XQr8EwxPMzJGhoR+d/nRFWdi15VaZ+R5Uhssm+Xx5yS30xCpuutfKRm4rerE0SK9j2dWB5Z3FvDD0w8WMVGzkA==",
|
"integrity": "sha512-2Ed5dJ+n/O3cU383xSY28cuVi0BCQhF8nYqWU5paEpl7fVdqdAmiLdqLyfblbNdfOFwFfi/mqU4O1pwc60iBhQ==",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,17 +70,17 @@
|
|||||||
"vitest": "^1.2.2"
|
"vitest": "^1.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-secrets-manager": "^3.502.0",
|
"@aws-sdk/client-secrets-manager": "^3.504.0",
|
||||||
"@casl/ability": "^6.5.0",
|
"@casl/ability": "^6.5.0",
|
||||||
"@fastify/cookie": "^9.2.0",
|
"@fastify/cookie": "^9.2.0",
|
||||||
"@fastify/cors": "^8.4.1",
|
"@fastify/cors": "^8.5.0",
|
||||||
"@fastify/etag": "^5.1.0",
|
"@fastify/etag": "^5.1.0",
|
||||||
"@fastify/formbody": "^7.4.0",
|
"@fastify/formbody": "^7.4.0",
|
||||||
"@fastify/helmet": "^11.1.1",
|
"@fastify/helmet": "^11.1.1",
|
||||||
"@fastify/passport": "^2.4.0",
|
"@fastify/passport": "^2.4.0",
|
||||||
"@fastify/rate-limit": "^9.0.0",
|
"@fastify/rate-limit": "^9.0.0",
|
||||||
"@fastify/session": "^10.7.0",
|
"@fastify/session": "^10.7.0",
|
||||||
"@fastify/swagger": "^8.12.0",
|
"@fastify/swagger": "^8.14.0",
|
||||||
"@fastify/swagger-ui": "^2.1.0",
|
"@fastify/swagger-ui": "^2.1.0",
|
||||||
"@node-saml/passport-saml": "^4.0.4",
|
"@node-saml/passport-saml": "^4.0.4",
|
||||||
"@octokit/rest": "^20.0.2",
|
"@octokit/rest": "^20.0.2",
|
||||||
@@ -91,12 +91,12 @@
|
|||||||
"ajv": "^8.12.0",
|
"ajv": "^8.12.0",
|
||||||
"argon2": "^0.31.2",
|
"argon2": "^0.31.2",
|
||||||
"aws-sdk": "^2.1545.0",
|
"aws-sdk": "^2.1545.0",
|
||||||
"axios": "^1.6.4",
|
"axios": "^1.6.7",
|
||||||
"axios-retry": "^4.0.0",
|
"axios-retry": "^4.0.0",
|
||||||
"bcrypt": "^5.1.1",
|
"bcrypt": "^5.1.1",
|
||||||
"bullmq": "^5.1.1",
|
"bullmq": "^5.1.6",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.1",
|
||||||
"fastify": "^4.24.3",
|
"fastify": "^4.26.0",
|
||||||
"fastify-plugin": "^4.5.1",
|
"fastify-plugin": "^4.5.1",
|
||||||
"handlebars": "^4.7.8",
|
"handlebars": "^4.7.8",
|
||||||
"ioredis": "^5.3.2",
|
"ioredis": "^5.3.2",
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
"knex": "^3.0.1",
|
"knex": "^3.0.1",
|
||||||
"libsodium-wrappers": "^0.7.13",
|
"libsodium-wrappers": "^0.7.13",
|
||||||
"lodash.isequal": "^4.5.0",
|
"lodash.isequal": "^4.5.0",
|
||||||
"mysql2": "^3.6.5",
|
"mysql2": "^3.9.1",
|
||||||
"nanoid": "^5.0.4",
|
"nanoid": "^5.0.4",
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"nodemailer": "^6.9.9",
|
"nodemailer": "^6.9.9",
|
||||||
@@ -125,6 +125,6 @@
|
|||||||
"tweetnacl-util": "^0.15.1",
|
"tweetnacl-util": "^0.15.1",
|
||||||
"uuid": "^9.0.1",
|
"uuid": "^9.0.1",
|
||||||
"zod": "^3.22.4",
|
"zod": "^3.22.4",
|
||||||
"zod-to-json-schema": "^3.22.0"
|
"zod-to-json-schema": "^3.22.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Knex } from "knex";
|
||||||
|
|
||||||
|
import { TableName } from "../schemas";
|
||||||
|
|
||||||
|
export async function up(knex: Knex): Promise<void> {
|
||||||
|
const isTablePresent = await knex.schema.hasTable(TableName.SuperAdmin);
|
||||||
|
if (isTablePresent) {
|
||||||
|
await knex.schema.alterTable(TableName.SuperAdmin, (t) => {
|
||||||
|
t.string("allowedSignUpDomain");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down(knex: Knex): Promise<void> {
|
||||||
|
if (await knex.schema.hasColumn(TableName.SuperAdmin, "allowedSignUpDomain")) {
|
||||||
|
await knex.schema.alterTable(TableName.SuperAdmin, (t) => {
|
||||||
|
t.dropColumn("allowedSignUpDomain");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,7 +12,8 @@ export const SuperAdminSchema = z.object({
|
|||||||
initialized: z.boolean().default(false).nullable().optional(),
|
initialized: z.boolean().default(false).nullable().optional(),
|
||||||
allowSignUp: z.boolean().default(true).nullable().optional(),
|
allowSignUp: z.boolean().default(true).nullable().optional(),
|
||||||
createdAt: z.date(),
|
createdAt: z.date(),
|
||||||
updatedAt: z.date()
|
updatedAt: z.date(),
|
||||||
|
allowedSignUpDomain: z.string().nullable().optional()
|
||||||
});
|
});
|
||||||
|
|
||||||
export type TSuperAdmin = z.infer<typeof SuperAdminSchema>;
|
export type TSuperAdmin = z.infer<typeof SuperAdminSchema>;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
|||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
export const registerScimRouter = async (server: FastifyZodProvider) => {
|
export const registerScimRouter = async (server: FastifyZodProvider) => {
|
||||||
server.addContentTypeParser("application/scim+json", { parseAs: "string" }, function (req, body, done) {
|
server.addContentTypeParser("application/scim+json", { parseAs: "string" }, (_, body, done) => {
|
||||||
try {
|
try {
|
||||||
const strBody = body instanceof Buffer ? body.toString() : body;
|
const strBody = body instanceof Buffer ? body.toString() : body;
|
||||||
|
|
||||||
|
|||||||
@@ -284,30 +284,11 @@ export const ldapConfigServiceFactory = ({
|
|||||||
organizationSlug: string;
|
organizationSlug: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// req.ldapConfig = getLdapCfg2(organization.id);
|
|
||||||
|
|
||||||
const boot = async () => {
|
const boot = async () => {
|
||||||
const organization = await orgDAL.findOne({ slug: organizationSlug });
|
const organization = await orgDAL.findOne({ slug: organizationSlug });
|
||||||
const ldapConfig = await getLdapCfg2(organization.id); // repeat?
|
const ldapConfig = await getLdapCfg2(organization.id); // repeat?
|
||||||
req.ldapConfig = ldapConfig;
|
req.ldapConfig = ldapConfig;
|
||||||
|
|
||||||
// example
|
|
||||||
// var opts = {
|
|
||||||
// server: {
|
|
||||||
// // url: 'ldaps://openldap:636', // connection over SSL/TLS
|
|
||||||
// url: 'ldap://openldap:389',
|
|
||||||
// bindDN: 'cn=admin,dc=acme,dc=com',
|
|
||||||
// bindCredentials: 'admin',
|
|
||||||
// searchBase: 'ou=people,dc=acme,dc=com',
|
|
||||||
// searchFilter: '(uid={{username}})',
|
|
||||||
// searchAttributes: ['uid', 'givenName', 'sn'], // optional, defaults to all (get username too)
|
|
||||||
// // tlsOptions: {
|
|
||||||
// // ca: [caCert]
|
|
||||||
// // }
|
|
||||||
// },
|
|
||||||
// passReqToCallback: true
|
|
||||||
// };
|
|
||||||
|
|
||||||
const opts = {
|
const opts = {
|
||||||
server: {
|
server: {
|
||||||
url: ldapConfig.url,
|
url: ldapConfig.url,
|
||||||
|
|||||||
@@ -177,6 +177,8 @@ export const permissionServiceFactory = ({
|
|||||||
|
|
||||||
const getServiceTokenProjectPermission = async (serviceTokenId: string, projectId: string) => {
|
const getServiceTokenProjectPermission = async (serviceTokenId: string, projectId: string) => {
|
||||||
const serviceToken = await serviceTokenDAL.findById(serviceTokenId);
|
const serviceToken = await serviceTokenDAL.findById(serviceTokenId);
|
||||||
|
if (!serviceToken) throw new BadRequestError({ message: "Service token not found" });
|
||||||
|
|
||||||
if (serviceToken.projectId !== projectId)
|
if (serviceToken.projectId !== projectId)
|
||||||
throw new UnauthorizedError({
|
throw new UnauthorizedError({
|
||||||
message: "Failed to find service authorization for given project"
|
message: "Failed to find service authorization for given project"
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { FastifyRequest } from "fastify";
|
||||||
|
|
||||||
|
import { ActorType } from "@app/services/auth/auth-type";
|
||||||
|
|
||||||
|
// this is a unique id for sending posthog event
|
||||||
|
export const getTelemetryDistinctId = (req: FastifyRequest) => {
|
||||||
|
if (req.auth.actor === ActorType.USER) {
|
||||||
|
return req.auth.user.email;
|
||||||
|
}
|
||||||
|
if (req.auth.actor === ActorType.IDENTITY) {
|
||||||
|
return `identity-${req.auth.identityId}`;
|
||||||
|
}
|
||||||
|
if (req.auth.actor === ActorType.SERVICE) {
|
||||||
|
return req.auth.serviceToken.createdByEmail || `service-token-null-creator-${req.auth.serviceTokenId}`; // when user gets removed from system
|
||||||
|
}
|
||||||
|
return "unknown-auth-data";
|
||||||
|
};
|
||||||
@@ -27,7 +27,7 @@ export type TAuthMode =
|
|||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
authMode: AuthMode.SERVICE_TOKEN;
|
authMode: AuthMode.SERVICE_TOKEN;
|
||||||
serviceToken: TServiceTokens;
|
serviceToken: TServiceTokens & { createdByEmail: string };
|
||||||
actor: ActorType.SERVICE;
|
actor: ActorType.SERVICE;
|
||||||
serviceTokenId: string;
|
serviceTokenId: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -598,4 +598,8 @@ export const registerRoutes = async (
|
|||||||
);
|
);
|
||||||
await server.register(registerV2Routes, { prefix: "/api/v2" });
|
await server.register(registerV2Routes, { prefix: "/api/v2" });
|
||||||
await server.register(registerV3Routes, { prefix: "/api/v3" });
|
await server.register(registerV3Routes, { prefix: "/api/v3" });
|
||||||
|
|
||||||
|
server.addHook("onClose", async () => {
|
||||||
|
await telemetryService.flushAll();
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ export const registerAdminRouter = async (server: FastifyZodProvider) => {
|
|||||||
method: "PATCH",
|
method: "PATCH",
|
||||||
schema: {
|
schema: {
|
||||||
body: z.object({
|
body: z.object({
|
||||||
allowSignUp: z.boolean().optional()
|
allowSignUp: z.boolean().optional(),
|
||||||
|
allowedSignUpDomain: z.string().optional().nullable()
|
||||||
}),
|
}),
|
||||||
response: {
|
response: {
|
||||||
200: z.object({
|
200: z.object({
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ import { z } from "zod";
|
|||||||
|
|
||||||
import { IdentitiesSchema, OrgMembershipRole } from "@app/db/schemas";
|
import { IdentitiesSchema, OrgMembershipRole } from "@app/db/schemas";
|
||||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
|
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -49,6 +51,17 @@ export const registerIdentityRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.services.telemetry.sendPostHogEvents({
|
||||||
|
event: PostHogEventTypes.MachineIdentityCreated,
|
||||||
|
distinctId: getTelemetryDistinctId(req),
|
||||||
|
properties: {
|
||||||
|
orgId: req.body.organizationId,
|
||||||
|
name: identity.name,
|
||||||
|
identityId: identity.id,
|
||||||
|
...req.auditLogInfo
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return { identity };
|
return { identity };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { z } from "zod";
|
|||||||
import { IntegrationsSchema } from "@app/db/schemas";
|
import { IntegrationsSchema } from "@app/db/schemas";
|
||||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
import { removeTrailingSlash, shake } from "@app/lib/fn";
|
import { removeTrailingSlash, shake } from "@app/lib/fn";
|
||||||
|
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
import { PostHogEventTypes, TIntegrationCreatedEvent } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -53,28 +55,40 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => {
|
|||||||
actorOrgId: req.permission.orgId,
|
actorOrgId: req.permission.orgId,
|
||||||
...req.body
|
...req.body
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const createIntegrationEventProperty = shake({
|
||||||
|
integrationId: integration.id.toString(),
|
||||||
|
integration: integration.integration,
|
||||||
|
environment: req.body.sourceEnvironment,
|
||||||
|
secretPath: req.body.secretPath,
|
||||||
|
url: integration.url,
|
||||||
|
app: integration.app,
|
||||||
|
appId: integration.appId,
|
||||||
|
targetEnvironment: integration.targetEnvironment,
|
||||||
|
targetEnvironmentId: integration.targetEnvironmentId,
|
||||||
|
targetService: integration.targetService,
|
||||||
|
targetServiceId: integration.targetServiceId,
|
||||||
|
path: integration.path,
|
||||||
|
region: integration.region
|
||||||
|
}) as TIntegrationCreatedEvent["properties"];
|
||||||
|
|
||||||
await server.services.auditLog.createAuditLog({
|
await server.services.auditLog.createAuditLog({
|
||||||
...req.auditLogInfo,
|
...req.auditLogInfo,
|
||||||
projectId: integrationAuth.projectId,
|
projectId: integrationAuth.projectId,
|
||||||
event: {
|
event: {
|
||||||
type: EventType.CREATE_INTEGRATION,
|
type: EventType.CREATE_INTEGRATION,
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
metadata: shake({
|
metadata: createIntegrationEventProperty
|
||||||
integrationId: integration.id.toString(),
|
}
|
||||||
integration: integration.integration,
|
});
|
||||||
environment: req.body.sourceEnvironment,
|
|
||||||
secretPath: req.body.secretPath,
|
server.services.telemetry.sendPostHogEvents({
|
||||||
url: integration.url,
|
event: PostHogEventTypes.IntegrationCreated,
|
||||||
app: integration.app,
|
distinctId: getTelemetryDistinctId(req),
|
||||||
appId: integration.appId,
|
properties: {
|
||||||
targetEnvironment: integration.targetEnvironment,
|
...createIntegrationEventProperty,
|
||||||
targetEnvironmentId: integration.targetEnvironmentId,
|
projectId: integrationAuth.projectId,
|
||||||
targetService: integration.targetService,
|
...req.auditLogInfo
|
||||||
targetServiceId: integration.targetServiceId,
|
|
||||||
path: integration.path,
|
|
||||||
region: integration.region
|
|
||||||
// eslint-disable-next-line
|
|
||||||
}) as any
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return { integration };
|
return { integration };
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
import { UsersSchema } from "@app/db/schemas";
|
import { UsersSchema } from "@app/db/schemas";
|
||||||
|
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
export const registerInviteOrgRouter = async (server: FastifyZodProvider) => {
|
export const registerInviteOrgRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
@@ -30,6 +32,15 @@ export const registerInviteOrgRouter = async (server: FastifyZodProvider) => {
|
|||||||
actorOrgId: req.permission.orgId
|
actorOrgId: req.permission.orgId
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.services.telemetry.sendPostHogEvents({
|
||||||
|
event: PostHogEventTypes.UserOrgInvitation,
|
||||||
|
distinctId: getTelemetryDistinctId(req),
|
||||||
|
properties: {
|
||||||
|
inviteeEmail: req.body.inviteeEmail,
|
||||||
|
...req.auditLogInfo
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
completeInviteLink,
|
completeInviteLink,
|
||||||
message: `Send an invite link to ${req.body.inviteeEmail}`
|
message: `Send an invite link to ${req.body.inviteeEmail}`
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import { BadRequestError } from "@app/lib/errors";
|
|||||||
import { logger } from "@app/lib/logger";
|
import { logger } from "@app/lib/logger";
|
||||||
import { fetchGithubEmails } from "@app/lib/requests/github";
|
import { fetchGithubEmails } from "@app/lib/requests/github";
|
||||||
import { AuthMethod } from "@app/services/auth/auth-type";
|
import { AuthMethod } from "@app/services/auth/auth-type";
|
||||||
import { getServerCfg } from "@app/services/super-admin/super-admin-service";
|
|
||||||
|
|
||||||
export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
@@ -42,7 +41,6 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
|||||||
async (req, _accessToken, _refreshToken, profile, cb) => {
|
async (req, _accessToken, _refreshToken, profile, cb) => {
|
||||||
try {
|
try {
|
||||||
const email = profile?.emails?.[0]?.value;
|
const email = profile?.emails?.[0]?.value;
|
||||||
const serverCfg = await getServerCfg();
|
|
||||||
if (!email)
|
if (!email)
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
message: "Email not found",
|
message: "Email not found",
|
||||||
@@ -54,8 +52,7 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
|||||||
firstName: profile?.name?.givenName || "",
|
firstName: profile?.name?.givenName || "",
|
||||||
lastName: profile?.name?.familyName || "",
|
lastName: profile?.name?.familyName || "",
|
||||||
authMethod: AuthMethod.GOOGLE,
|
authMethod: AuthMethod.GOOGLE,
|
||||||
callbackPort: req.query.state as string,
|
callbackPort: req.query.state as string
|
||||||
isSignupAllowed: Boolean(serverCfg.allowSignUp)
|
|
||||||
});
|
});
|
||||||
cb(null, { isUserCompleted, providerAuthToken });
|
cb(null, { isUserCompleted, providerAuthToken });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -84,14 +81,12 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
|||||||
try {
|
try {
|
||||||
const ghEmails = await fetchGithubEmails(accessToken);
|
const ghEmails = await fetchGithubEmails(accessToken);
|
||||||
const { email } = ghEmails.filter((gitHubEmail) => gitHubEmail.primary)[0];
|
const { email } = ghEmails.filter((gitHubEmail) => gitHubEmail.primary)[0];
|
||||||
const serverCfg = await getServerCfg();
|
|
||||||
const { isUserCompleted, providerAuthToken } = await server.services.login.oauth2Login({
|
const { isUserCompleted, providerAuthToken } = await server.services.login.oauth2Login({
|
||||||
email,
|
email,
|
||||||
firstName: profile.displayName,
|
firstName: profile.displayName,
|
||||||
lastName: "",
|
lastName: "",
|
||||||
authMethod: AuthMethod.GITHUB,
|
authMethod: AuthMethod.GITHUB,
|
||||||
callbackPort: req.query.state as string,
|
callbackPort: req.query.state as string
|
||||||
isSignupAllowed: Boolean(serverCfg.allowSignUp)
|
|
||||||
});
|
});
|
||||||
return cb(null, { isUserCompleted, providerAuthToken });
|
return cb(null, { isUserCompleted, providerAuthToken });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -120,14 +115,12 @@ export const registerSsoRouter = async (server: FastifyZodProvider) => {
|
|||||||
async (req: any, _accessToken: string, _refreshToken: string, profile: any, cb: any) => {
|
async (req: any, _accessToken: string, _refreshToken: string, profile: any, cb: any) => {
|
||||||
try {
|
try {
|
||||||
const email = profile.emails[0].value;
|
const email = profile.emails[0].value;
|
||||||
const serverCfg = await getServerCfg();
|
|
||||||
const { isUserCompleted, providerAuthToken } = await server.services.login.oauth2Login({
|
const { isUserCompleted, providerAuthToken } = await server.services.login.oauth2Login({
|
||||||
email,
|
email,
|
||||||
firstName: profile.displayName,
|
firstName: profile.displayName,
|
||||||
lastName: "",
|
lastName: "",
|
||||||
authMethod: AuthMethod.GITLAB,
|
authMethod: AuthMethod.GITLAB,
|
||||||
callbackPort: req.query.state as string,
|
callbackPort: req.query.state as string
|
||||||
isSignupAllowed: Boolean(serverCfg.allowSignUp)
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return cb(null, { isUserCompleted, providerAuthToken });
|
return cb(null, { isUserCompleted, providerAuthToken });
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import { z } from "zod";
|
|||||||
import { ProjectKeysSchema, ProjectsSchema } from "@app/db/schemas";
|
import { ProjectKeysSchema, ProjectsSchema } from "@app/db/schemas";
|
||||||
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
||||||
import { authRateLimit } from "@app/server/config/rateLimiter";
|
import { authRateLimit } from "@app/server/config/rateLimiter";
|
||||||
|
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { AuthMode } from "@app/services/auth/auth-type";
|
import { AuthMode } from "@app/services/auth/auth-type";
|
||||||
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
const projectWithEnv = ProjectsSchema.merge(
|
const projectWithEnv = ProjectsSchema.merge(
|
||||||
z.object({
|
z.object({
|
||||||
@@ -152,6 +154,16 @@ export const registerProjectRouter = async (server: FastifyZodProvider) => {
|
|||||||
slug: req.body.slug
|
slug: req.body.slug
|
||||||
});
|
});
|
||||||
|
|
||||||
|
server.services.telemetry.sendPostHogEvents({
|
||||||
|
event: PostHogEventTypes.ProjectCreated,
|
||||||
|
distinctId: getTelemetryDistinctId(req),
|
||||||
|
properties: {
|
||||||
|
orgId: req.body.organizationId,
|
||||||
|
name: project.name,
|
||||||
|
...req.auditLogInfo
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return { project };
|
return { project };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { FastifyRequest } from "fastify";
|
|
||||||
import picomatch from "picomatch";
|
import picomatch from "picomatch";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
|
|
||||||
@@ -13,6 +12,7 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";
|
|||||||
import { CommitType } from "@app/ee/services/secret-approval-request/secret-approval-request-types";
|
import { CommitType } from "@app/ee/services/secret-approval-request/secret-approval-request-types";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { removeTrailingSlash } from "@app/lib/fn";
|
import { removeTrailingSlash } from "@app/lib/fn";
|
||||||
|
import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
|
||||||
import { getUserAgentType } from "@app/server/plugins/audit-log";
|
import { getUserAgentType } from "@app/server/plugins/audit-log";
|
||||||
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
|
||||||
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
|
||||||
@@ -20,19 +20,6 @@ import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
|||||||
|
|
||||||
import { secretRawSchema } from "../sanitizedSchemas";
|
import { secretRawSchema } from "../sanitizedSchemas";
|
||||||
|
|
||||||
const getDistinctId = (req: FastifyRequest) => {
|
|
||||||
if (req.auth.actor === ActorType.USER) {
|
|
||||||
return req.auth.user.email ?? req.auth.user.username ?? "unknown-user";
|
|
||||||
}
|
|
||||||
if (req.auth.actor === ActorType.IDENTITY) {
|
|
||||||
return `identity-${req.auth.identityId}`;
|
|
||||||
}
|
|
||||||
if (req.auth.actor === ActorType.SERVICE) {
|
|
||||||
return `service-token-${req.auth.serviceToken.id}`;
|
|
||||||
}
|
|
||||||
return "unknown-auth-data";
|
|
||||||
};
|
|
||||||
|
|
||||||
export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
||||||
server.route({
|
server.route({
|
||||||
url: "/raw",
|
url: "/raw",
|
||||||
@@ -110,7 +97,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretPulled,
|
event: PostHogEventTypes.SecretPulled,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: secrets.length,
|
numberOfSecrets: secrets.length,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@@ -200,7 +187,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretPulled,
|
event: PostHogEventTypes.SecretPulled,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId,
|
workspaceId,
|
||||||
@@ -276,7 +263,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretCreated,
|
event: PostHogEventTypes.SecretCreated,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -351,7 +338,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretUpdated,
|
event: PostHogEventTypes.SecretUpdated,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -421,7 +408,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretDeleted,
|
event: PostHogEventTypes.SecretDeleted,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -527,7 +514,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
if (shouldCapture) {
|
if (shouldCapture) {
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretPulled,
|
event: PostHogEventTypes.SecretPulled,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: shouldRecordK8Event ? approximateNumberTotalSecrets : secrets.length,
|
numberOfSecrets: shouldRecordK8Event ? approximateNumberTotalSecrets : secrets.length,
|
||||||
workspaceId: req.query.workspaceId,
|
workspaceId: req.query.workspaceId,
|
||||||
@@ -604,7 +591,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretPulled,
|
event: PostHogEventTypes.SecretPulled,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.query.workspaceId,
|
workspaceId: req.query.workspaceId,
|
||||||
@@ -767,7 +754,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretCreated,
|
event: PostHogEventTypes.SecretCreated,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -949,7 +936,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretUpdated,
|
event: PostHogEventTypes.SecretUpdated,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -1067,7 +1054,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretDeleted,
|
event: PostHogEventTypes.SecretDeleted,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: 1,
|
numberOfSecrets: 1,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -1187,7 +1174,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretCreated,
|
event: PostHogEventTypes.SecretCreated,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: secrets.length,
|
numberOfSecrets: secrets.length,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -1307,7 +1294,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretUpdated,
|
event: PostHogEventTypes.SecretUpdated,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: secrets.length,
|
numberOfSecrets: secrets.length,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
@@ -1415,7 +1402,7 @@ export const registerSecretRouter = async (server: FastifyZodProvider) => {
|
|||||||
|
|
||||||
server.services.telemetry.sendPostHogEvents({
|
server.services.telemetry.sendPostHogEvents({
|
||||||
event: PostHogEventTypes.SecretDeleted,
|
event: PostHogEventTypes.SecretDeleted,
|
||||||
distinctId: getDistinctId(req),
|
distinctId: getTelemetryDistinctId(req),
|
||||||
properties: {
|
properties: {
|
||||||
numberOfSecrets: secrets.length,
|
numberOfSecrets: secrets.length,
|
||||||
workspaceId: req.body.workspaceId,
|
workspaceId: req.body.workspaceId,
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import { z } from "zod";
|
|||||||
|
|
||||||
import { UsersSchema } from "@app/db/schemas";
|
import { UsersSchema } from "@app/db/schemas";
|
||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig } from "@app/lib/config/env";
|
||||||
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
import { authRateLimit } from "@app/server/config/rateLimiter";
|
import { authRateLimit } from "@app/server/config/rateLimiter";
|
||||||
|
import { getServerCfg } from "@app/services/super-admin/super-admin-service";
|
||||||
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
|
||||||
|
|
||||||
export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
||||||
@@ -23,8 +25,26 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handler: async (req) => {
|
handler: async (req) => {
|
||||||
await server.services.signup.beginEmailSignupProcess(req.body.email);
|
const { email } = req.body;
|
||||||
return { message: `Sent an email verification code to ${req.body.email}` };
|
|
||||||
|
const serverCfg = await getServerCfg();
|
||||||
|
if (!serverCfg.allowSignUp) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Sign up is disabled"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (serverCfg?.allowedSignUpDomain) {
|
||||||
|
const domain = email.split("@")[1];
|
||||||
|
const allowedDomains = serverCfg.allowedSignUpDomain.split(",").map((e) => e.trim());
|
||||||
|
if (!allowedDomains.includes(domain)) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: `Email with a domain (@${domain}) is not supported`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await server.services.signup.beginEmailSignupProcess(email);
|
||||||
|
return { message: `Sent an email verification code to ${email}` };
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -48,6 +68,13 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
handler: async (req) => {
|
handler: async (req) => {
|
||||||
|
const serverCfg = await getServerCfg();
|
||||||
|
if (!serverCfg.allowSignUp) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Sign up is disabled"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const { token, user } = await server.services.signup.verifyEmailSignup(req.body.email, req.body.code);
|
const { token, user } = await server.services.signup.verifyEmailSignup(req.body.email, req.body.code);
|
||||||
return { message: "Successfuly verified email", token, user };
|
return { message: "Successfuly verified email", token, user };
|
||||||
}
|
}
|
||||||
@@ -90,6 +117,13 @@ export const registerSignupRouter = async (server: FastifyZodProvider) => {
|
|||||||
if (!userAgent) throw new Error("user agent header is required");
|
if (!userAgent) throw new Error("user agent header is required");
|
||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
|
|
||||||
|
const serverCfg = await getServerCfg();
|
||||||
|
if (!serverCfg.allowSignUp) {
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: "Sign up is disabled"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const { user, accessToken, refreshToken } = await server.services.signup.completeEmailAccountSignup({
|
const { user, accessToken, refreshToken } = await server.services.signup.completeEmailAccountSignup({
|
||||||
...req.body,
|
...req.body,
|
||||||
ip: req.realIp,
|
ip: req.realIp,
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { TUsers, UserDeviceSchema } from "@app/db/schemas";
|
|||||||
import { getConfig } from "@app/lib/config/env";
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { generateSrpServerKey, srpCheckClientProof } from "@app/lib/crypto";
|
import { generateSrpServerKey, srpCheckClientProof } from "@app/lib/crypto";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
|
import { getServerCfg } from "@app/services/super-admin/super-admin-service";
|
||||||
|
|
||||||
import { TAuthTokenServiceFactory } from "../auth-token/auth-token-service";
|
import { TAuthTokenServiceFactory } from "../auth-token/auth-token-service";
|
||||||
import { TokenType } from "../auth-token/auth-token-types";
|
import { TokenType } from "../auth-token/auth-token-types";
|
||||||
@@ -265,20 +266,26 @@ export const authLoginServiceFactory = ({ userDAL, tokenService, smtpService }:
|
|||||||
/*
|
/*
|
||||||
* OAuth2 login for google,github, and other oauth2 provider
|
* OAuth2 login for google,github, and other oauth2 provider
|
||||||
* */
|
* */
|
||||||
const oauth2Login = async ({
|
const oauth2Login = async ({ email, firstName, lastName, authMethod, callbackPort }: TOauthLoginDTO) => {
|
||||||
email,
|
|
||||||
firstName,
|
|
||||||
lastName,
|
|
||||||
authMethod,
|
|
||||||
callbackPort,
|
|
||||||
isSignupAllowed
|
|
||||||
}: TOauthLoginDTO) => {
|
|
||||||
let user = await userDAL.findUserByEmail(email);
|
let user = await userDAL.findUserByEmail(email);
|
||||||
|
const serverCfg = await getServerCfg();
|
||||||
|
|
||||||
const appCfg = getConfig();
|
const appCfg = getConfig();
|
||||||
const isOauthSignUpDisabled = !isSignupAllowed && !user;
|
|
||||||
if (isOauthSignUpDisabled) throw new BadRequestError({ message: "User signup disabled", name: "Oauth 2 login" });
|
|
||||||
|
|
||||||
if (!user) {
|
if (!user) {
|
||||||
|
// Create a new user based on oAuth
|
||||||
|
if (!serverCfg?.allowSignUp) throw new BadRequestError({ message: "Sign up disabled", name: "Oauth 2 login" });
|
||||||
|
|
||||||
|
if (serverCfg?.allowedSignUpDomain) {
|
||||||
|
const domain = email.split("@")[1];
|
||||||
|
const allowedDomains = serverCfg.allowedSignUpDomain.split(",").map((e) => e.trim());
|
||||||
|
if (!allowedDomains.includes(domain))
|
||||||
|
throw new BadRequestError({
|
||||||
|
message: `Email with a domain (@${domain}) is not supported`,
|
||||||
|
name: "Oauth 2 login"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
user = await userDAL.create({ email, firstName, lastName, authMethods: [authMethod], isGhost: false });
|
user = await userDAL.create({ email, firstName, lastName, authMethods: [authMethod], isGhost: false });
|
||||||
}
|
}
|
||||||
const isLinkingRequired = !user?.authMethods?.includes(authMethod);
|
const isLinkingRequired = !user?.authMethods?.includes(authMethod);
|
||||||
|
|||||||
@@ -28,5 +28,4 @@ export type TOauthLoginDTO = {
|
|||||||
lastName?: string;
|
lastName?: string;
|
||||||
authMethod: AuthMethod;
|
authMethod: AuthMethod;
|
||||||
callbackPort?: string;
|
callbackPort?: string;
|
||||||
isSignupAllowed?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -421,10 +421,6 @@ export const projectMembershipServiceFactory = ({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.version === ProjectVersion.V1) {
|
|
||||||
throw new BadRequestError({ message: "Please upgrade your project on your dashboard" });
|
|
||||||
}
|
|
||||||
|
|
||||||
const projectMembers = await projectMembershipDAL.findMembershipsByEmail(projectId, emails);
|
const projectMembers = await projectMembershipDAL.findMembershipsByEmail(projectId, emails);
|
||||||
|
|
||||||
if (projectMembers.length !== emails.length) {
|
if (projectMembers.length !== emails.length) {
|
||||||
|
|||||||
@@ -33,11 +33,12 @@ export const assignWorkspaceKeysToMembers = ({ members, decryptKey, userPrivateK
|
|||||||
type TCreateProjectKeyDTO = {
|
type TCreateProjectKeyDTO = {
|
||||||
publicKey: string;
|
publicKey: string;
|
||||||
privateKey: string;
|
privateKey: string;
|
||||||
|
plainProjectKey?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createProjectKey = ({ publicKey, privateKey }: TCreateProjectKeyDTO) => {
|
export const createProjectKey = ({ publicKey, privateKey, plainProjectKey }: TCreateProjectKeyDTO) => {
|
||||||
// 3. Create a random key that we'll use as the project key.
|
// 3. Create a random key that we'll use as the project key.
|
||||||
const randomBytes = crypto.randomBytes(16).toString("hex");
|
const randomBytes = plainProjectKey || crypto.randomBytes(16).toString("hex");
|
||||||
|
|
||||||
// 4. Encrypt the project key with the users key pair.
|
// 4. Encrypt the project key with the users key pair.
|
||||||
const { ciphertext: encryptedProjectKey, nonce: encryptedProjectKeyIv } = encryptAsymmetric(
|
const { ciphertext: encryptedProjectKey, nonce: encryptedProjectKeyIv } = encryptAsymmetric(
|
||||||
|
|||||||
@@ -122,6 +122,13 @@ export const projectQueueFactory = ({
|
|||||||
tag: data.encryptedPrivateKey.encryptedKeyTag
|
tag: data.encryptedPrivateKey.encryptedKeyTag
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const decryptedPlainProjectKey = decryptAsymmetric({
|
||||||
|
ciphertext: oldProjectKey.encryptedKey,
|
||||||
|
nonce: oldProjectKey.nonce,
|
||||||
|
publicKey: oldProjectKey.sender.publicKey,
|
||||||
|
privateKey: userPrivateKey
|
||||||
|
});
|
||||||
|
|
||||||
const projectEnvs = await projectEnvDAL.find({
|
const projectEnvs = await projectEnvDAL.find({
|
||||||
projectId: project.id
|
projectId: project.id
|
||||||
});
|
});
|
||||||
@@ -199,6 +206,7 @@ export const projectQueueFactory = ({
|
|||||||
|
|
||||||
// Create a project key
|
// Create a project key
|
||||||
const { key: newEncryptedProjectKey, iv: newEncryptedProjectKeyIv } = createProjectKey({
|
const { key: newEncryptedProjectKey, iv: newEncryptedProjectKeyIv } = createProjectKey({
|
||||||
|
plainProjectKey: decryptedPlainProjectKey,
|
||||||
publicKey: ghostUser.keys.publicKey,
|
publicKey: ghostUser.keys.publicKey,
|
||||||
privateKey: ghostUser.keys.plainPrivateKey
|
privateKey: ghostUser.keys.plainPrivateKey
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,10 +1,32 @@
|
|||||||
|
import { Knex } from "knex";
|
||||||
|
|
||||||
import { TDbClient } from "@app/db";
|
import { TDbClient } from "@app/db";
|
||||||
import { TableName } from "@app/db/schemas";
|
import { TableName, TUsers } from "@app/db/schemas";
|
||||||
import { ormify } from "@app/lib/knex";
|
import { DatabaseError } from "@app/lib/errors";
|
||||||
|
import { ormify, selectAllTableCols } from "@app/lib/knex";
|
||||||
|
|
||||||
export type TServiceTokenDALFactory = ReturnType<typeof serviceTokenDALFactory>;
|
export type TServiceTokenDALFactory = ReturnType<typeof serviceTokenDALFactory>;
|
||||||
|
|
||||||
export const serviceTokenDALFactory = (db: TDbClient) => {
|
export const serviceTokenDALFactory = (db: TDbClient) => {
|
||||||
const stOrm = ormify(db, TableName.ServiceToken);
|
const stOrm = ormify(db, TableName.ServiceToken);
|
||||||
return stOrm;
|
|
||||||
|
const findById = async (id: string, tx?: Knex) => {
|
||||||
|
try {
|
||||||
|
const doc = await (tx || db)(TableName.ServiceToken)
|
||||||
|
.leftJoin<TUsers>(
|
||||||
|
TableName.Users,
|
||||||
|
`${TableName.Users}.id`,
|
||||||
|
db.raw(`${TableName.ServiceToken}."createdBy"::uuid`)
|
||||||
|
)
|
||||||
|
.where(`${TableName.ServiceToken}.id`, id)
|
||||||
|
.select(selectAllTableCols(TableName.ServiceToken))
|
||||||
|
.select(db.ref("email").withSchema(TableName.Users).as("createdByEmail"))
|
||||||
|
.first();
|
||||||
|
return doc;
|
||||||
|
} catch (err) {
|
||||||
|
throw new DatabaseError({ error: err, name: "FindById" });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return { ...stOrm, findById };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ export const serviceTokenServiceFactory = ({
|
|||||||
const updatedToken = await serviceTokenDAL.updateById(serviceToken.id, {
|
const updatedToken = await serviceTokenDAL.updateById(serviceToken.id, {
|
||||||
lastUsed: new Date()
|
lastUsed: new Date()
|
||||||
});
|
});
|
||||||
return updatedToken;
|
return { ...serviceToken, lastUsed: updatedToken.lastUsed };
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -61,8 +61,15 @@ To opt into telemetry, you can set "TELEMETRY_ENABLED=true" within the environme
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const flushAll = async () => {
|
||||||
|
if (postHog) {
|
||||||
|
await postHog.shutdownAsync();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sendLoopsEvent,
|
sendLoopsEvent,
|
||||||
sendPostHogEvents
|
sendPostHogEvents,
|
||||||
|
flushAll
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ export enum PostHogEventTypes {
|
|||||||
UserSignedUp = "User Signed Up",
|
UserSignedUp = "User Signed Up",
|
||||||
SecretRotated = "secrets rotated",
|
SecretRotated = "secrets rotated",
|
||||||
SecretScannerFull = "historical cloud secret scan",
|
SecretScannerFull = "historical cloud secret scan",
|
||||||
SecretScannerPush = "cloud secret scan"
|
SecretScannerPush = "cloud secret scan",
|
||||||
|
ProjectCreated = "Project Created",
|
||||||
|
IntegrationCreated = "Integration Created",
|
||||||
|
MachineIdentityCreated = "Machine Identity Created",
|
||||||
|
UserOrgInvitation = "User Org Invitation"
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TSecretModifiedEvent = {
|
export type TSecretModifiedEvent = {
|
||||||
@@ -53,9 +57,57 @@ export type TSecretScannerEvent = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type TProjectCreateEvent = {
|
||||||
|
event: PostHogEventTypes.ProjectCreated;
|
||||||
|
properties: {
|
||||||
|
name: string;
|
||||||
|
orgId: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TMachineIdentityCreatedEvent = {
|
||||||
|
event: PostHogEventTypes.MachineIdentityCreated;
|
||||||
|
properties: {
|
||||||
|
name: string;
|
||||||
|
orgId: string;
|
||||||
|
identityId: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TIntegrationCreatedEvent = {
|
||||||
|
event: PostHogEventTypes.IntegrationCreated;
|
||||||
|
properties: {
|
||||||
|
projectId: string;
|
||||||
|
integrationId: string;
|
||||||
|
integration: string; // TODO: fix type
|
||||||
|
environment: string;
|
||||||
|
secretPath: string;
|
||||||
|
url?: string;
|
||||||
|
app?: string;
|
||||||
|
appId?: string;
|
||||||
|
targetEnvironment?: string;
|
||||||
|
targetEnvironmentId?: string;
|
||||||
|
targetService?: string;
|
||||||
|
targetServiceId?: string;
|
||||||
|
path?: string;
|
||||||
|
region?: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type TUserOrgInvitedEvent = {
|
||||||
|
event: PostHogEventTypes.UserOrgInvitation;
|
||||||
|
properties: {
|
||||||
|
inviteeEmail: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export type TPostHogEvent = { distinctId: string } & (
|
export type TPostHogEvent = { distinctId: string } & (
|
||||||
| TSecretModifiedEvent
|
| TSecretModifiedEvent
|
||||||
| TAdminInitEvent
|
| TAdminInitEvent
|
||||||
| TUserSignedUpEvent
|
| TUserSignedUpEvent
|
||||||
| TSecretScannerEvent
|
| TSecretScannerEvent
|
||||||
|
| TUserOrgInvitedEvent
|
||||||
|
| TMachineIdentityCreatedEvent
|
||||||
|
| TIntegrationCreatedEvent
|
||||||
|
| TProjectCreateEvent
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -126,8 +126,35 @@ services:
|
|||||||
- 1025:1025 # SMTP server
|
- 1025:1025 # SMTP server
|
||||||
- 8025:8025 # Web UI
|
- 8025:8025 # Web UI
|
||||||
|
|
||||||
|
openldap: # note: more advanced configuration is available
|
||||||
|
image: osixia/openldap:1.5.0
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
LDAP_ORGANISATION: Acme
|
||||||
|
LDAP_DOMAIN: acme.com
|
||||||
|
LDAP_ADMIN_PASSWORD: admin
|
||||||
|
ports:
|
||||||
|
- 389:389
|
||||||
|
- 636:636
|
||||||
|
volumes:
|
||||||
|
- ldap_data:/var/lib/ldap
|
||||||
|
- ldap_config:/etc/ldap/slapd.d
|
||||||
|
|
||||||
|
phpldapadmin: # username: cn=admin,dc=acme,dc=com, pass is admin
|
||||||
|
image: osixia/phpldapadmin:latest
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
- PHPLDAPADMIN_LDAP_HOSTS=openldap
|
||||||
|
- PHPLDAPADMIN_HTTPS=false
|
||||||
|
ports:
|
||||||
|
- 6433:80
|
||||||
|
depends_on:
|
||||||
|
- openldap
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres-data:
|
postgres-data:
|
||||||
driver: local
|
driver: local
|
||||||
redis_data:
|
redis_data:
|
||||||
driver: local
|
driver: local
|
||||||
|
ldap_data:
|
||||||
|
ldap_config:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
title: "Create Workspace"
|
title: "Create Project"
|
||||||
openapi: "POST /api/v2/workspace"
|
openapi: "POST /api/v2/workspace"
|
||||||
---
|
---
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: "Delete Workspace"
|
title: "Delete Project"
|
||||||
openapi: "DELETE /api/v1/workspace/{workspaceId}"
|
openapi: "DELETE /api/v1/workspace/{workspaceId}"
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
title: "Get Workspace"
|
title: "Get Project"
|
||||||
openapi: "GET /api/v1/workspace/{workspaceId}"
|
openapi: "GET /api/v1/workspace/{workspaceId}"
|
||||||
---
|
---
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
---
|
---
|
||||||
title: "Update Workspace"
|
title: "Update Project"
|
||||||
openapi: "PATCH /api/v1/workspace/{workspaceId}"
|
openapi: "PATCH /api/v1/workspace/{workspaceId}"
|
||||||
---
|
---
|
||||||
@@ -75,7 +75,7 @@ app.get("/", async (req, res) => {
|
|||||||
app.listen(PORT, async () => {
|
app.listen(PORT, async () => {
|
||||||
// initialize client
|
// initialize client
|
||||||
|
|
||||||
console.log(`App listening on port ${port}`);
|
console.log(`App listening on port ${PORT}`);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ app.get("/", async (req, res) => {
|
|||||||
app.listen(PORT, async () => {
|
app.listen(PORT, async () => {
|
||||||
// initialize client
|
// initialize client
|
||||||
|
|
||||||
console.log(`App listening on port ${port}`);
|
console.log(`App listening on port ${PORT}`);
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Generated
+5
-5
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "npm-proj-1708142380787-0.9952765718063858vJAsWg",
|
"name": "npm-proj-1708687711895-0.8280111363176879xoEiUg",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
@@ -82,7 +82,7 @@
|
|||||||
"react-markdown": "^8.0.3",
|
"react-markdown": "^8.0.3",
|
||||||
"react-redux": "^8.0.2",
|
"react-redux": "^8.0.2",
|
||||||
"react-table": "^7.8.0",
|
"react-table": "^7.8.0",
|
||||||
"sanitize-html": "^2.11.0",
|
"sanitize-html": "^2.12.1",
|
||||||
"set-cookie-parser": "^2.5.1",
|
"set-cookie-parser": "^2.5.1",
|
||||||
"sharp": "^0.33.2",
|
"sharp": "^0.33.2",
|
||||||
"styled-components": "^5.3.7",
|
"styled-components": "^5.3.7",
|
||||||
@@ -21111,9 +21111,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/sanitize-html": {
|
"node_modules/sanitize-html": {
|
||||||
"version": "2.11.0",
|
"version": "2.12.1",
|
||||||
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.12.1.tgz",
|
||||||
"integrity": "sha512-BG68EDHRaGKqlsNjJ2xUB7gpInPA8gVx/mvjO743hZaeMCZ2DwzW7xvsqZ+KNU4QKwj86HJ3uu2liISf2qBBUA==",
|
"integrity": "sha512-Plh+JAn0UVDpBRP/xEjsk+xDCoOvMBwQUf/K+/cBAVuTbtX8bj2VB7S1sL1dssVpykqp0/KPSesHrqXtokVBpA==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"deepmerge": "^4.2.2",
|
"deepmerge": "^4.2.2",
|
||||||
"escape-string-regexp": "^4.0.0",
|
"escape-string-regexp": "^4.0.0",
|
||||||
|
|||||||
@@ -90,7 +90,7 @@
|
|||||||
"react-markdown": "^8.0.3",
|
"react-markdown": "^8.0.3",
|
||||||
"react-redux": "^8.0.2",
|
"react-redux": "^8.0.2",
|
||||||
"react-table": "^7.8.0",
|
"react-table": "^7.8.0",
|
||||||
"sanitize-html": "^2.11.0",
|
"sanitize-html": "^2.12.1",
|
||||||
"set-cookie-parser": "^2.5.1",
|
"set-cookie-parser": "^2.5.1",
|
||||||
"sharp": "^0.33.2",
|
"sharp": "^0.33.2",
|
||||||
"styled-components": "^5.3.7",
|
"styled-components": "^5.3.7",
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import axios from "axios";
|
||||||
|
|
||||||
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import { useSendVerificationEmail } from "@app/hooks/api";
|
import { useSendVerificationEmail } from "@app/hooks/api";
|
||||||
|
|
||||||
import { Button, Input } from "../v2";
|
import { Button, Input } from "../v2";
|
||||||
@@ -25,6 +27,7 @@ export default function EnterEmailStep({
|
|||||||
setEmail,
|
setEmail,
|
||||||
incrementStep
|
incrementStep
|
||||||
}: DownloadBackupPDFStepProps): JSX.Element {
|
}: DownloadBackupPDFStepProps): JSX.Element {
|
||||||
|
const { createNotification } = useNotificationContext();
|
||||||
const { mutateAsync } = useSendVerificationEmail();
|
const { mutateAsync } = useSendVerificationEmail();
|
||||||
const [emailError, setEmailError] = useState(false);
|
const [emailError, setEmailError] = useState(false);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -46,8 +49,18 @@ export default function EnterEmailStep({
|
|||||||
|
|
||||||
// If everything is correct, go to the next step
|
// If everything is correct, go to the next step
|
||||||
if (!emailCheckBool) {
|
if (!emailCheckBool) {
|
||||||
await mutateAsync({ email });
|
try {
|
||||||
incrementStep();
|
await mutateAsync({ email });
|
||||||
|
incrementStep();
|
||||||
|
} catch(e) {
|
||||||
|
if (axios.isAxiosError(e)) {
|
||||||
|
const { message = "Something went wrong" } = e.response?.data as { message: string};
|
||||||
|
createNotification({
|
||||||
|
type: "error",
|
||||||
|
text: message
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ export const UpgradeOverlay = () => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for non admin this would throw an error
|
return !isUpgradeStatusLoading && isUpgrading ? (
|
||||||
// so no need to render
|
|
||||||
return !isUpgradeStatusLoading && isUpgrading ? ( // isUpgrading
|
|
||||||
<div className="absolute top-0 left-0 z-50 flex h-screen w-screen items-center justify-center bg-bunker-500 bg-opacity-80">
|
<div className="absolute top-0 left-0 z-50 flex h-screen w-screen items-center justify-center bg-bunker-500 bg-opacity-80">
|
||||||
<Spinner size="lg" className="text-primary" />
|
<Spinner size="lg" className="text-primary" />
|
||||||
<div className="ml-4 flex flex-col space-y-1">
|
<div className="ml-4 flex flex-col space-y-1">
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { useCallback, useState } from "react";
|
|||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { faWarning } from "@fortawesome/free-solid-svg-icons";
|
import { faWarning } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
import { useProjectPermission } from "@app/context";
|
import { useProjectPermission } from "@app/context";
|
||||||
@@ -10,6 +11,7 @@ import { Workspace } from "@app/hooks/api/types";
|
|||||||
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||||
|
|
||||||
import { Button } from "../Button";
|
import { Button } from "../Button";
|
||||||
|
import { Tooltip } from "../Tooltip";
|
||||||
|
|
||||||
export type UpgradeProjectAlertProps = {
|
export type UpgradeProjectAlertProps = {
|
||||||
project: Workspace;
|
project: Workspace;
|
||||||
@@ -83,20 +85,44 @@ export const UpgradeProjectAlert = ({ project }: UpgradeProjectAlertProps): JSX.
|
|||||||
projectStatus?.status !== "FAILED");
|
projectStatus?.status !== "FAILED");
|
||||||
|
|
||||||
if (project.version !== ProjectVersion.V1) return null;
|
if (project.version !== ProjectVersion.V1) return null;
|
||||||
if (membership.role !== "admin") return null;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mt-4 flex w-full flex-row items-center rounded-md border border-primary-600/70 bg-primary/[.07] p-4 text-base text-white">
|
<div
|
||||||
|
className={twMerge(
|
||||||
|
"mt-4 flex w-full flex-row items-center rounded-md border border-primary-600/70 bg-primary/[.07] p-4 text-base text-white",
|
||||||
|
membership.role !== "admin" && "opacity-80"
|
||||||
|
)}
|
||||||
|
>
|
||||||
<FontAwesomeIcon icon={faWarning} className="pr-6 text-6xl text-white/80" />
|
<FontAwesomeIcon icon={faWarning} className="pr-6 text-6xl text-white/80" />
|
||||||
<div className="flex w-full flex-col text-sm">
|
<div className="flex w-full flex-col text-sm">
|
||||||
<span className="mb-2 text-lg font-semibold">Upgrade your project</span>
|
<span className="mb-2 text-lg font-semibold">Upgrade your project</span>
|
||||||
Upgrade your project version to continue receiving the latest improvements and patches.
|
{membership.role === "admin" ? (
|
||||||
|
<p>
|
||||||
|
Upgrade your project version to continue receiving the latest improvements and patches.
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p>
|
||||||
|
<span className="font-bold">Please ask a project admin to upgrade the project.</span>
|
||||||
|
<br />
|
||||||
|
Upgrading the project version is required to continue receiving the latest improvements
|
||||||
|
and patches.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
{currentStatus && <p className="mt-2 opacity-80">Status: {currentStatus}</p>}
|
{currentStatus && <p className="mt-2 opacity-80">Status: {currentStatus}</p>}
|
||||||
</div>
|
</div>
|
||||||
<div className="my-2">
|
<div className="my-2">
|
||||||
<Button isLoading={isLoading} isDisabled={isLoading} onClick={onUpgradeProject}>
|
<Tooltip
|
||||||
Upgrade
|
className={twMerge(membership.role === "admin" && "hidden")}
|
||||||
</Button>
|
content="You need to be an admin to upgrade the project."
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
isLoading={isLoading}
|
||||||
|
isDisabled={isLoading || membership.role !== "admin"}
|
||||||
|
onClick={onUpgradeProject}
|
||||||
|
>
|
||||||
|
Upgrade
|
||||||
|
</Button>
|
||||||
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
export type TServerConfig = {
|
export type TServerConfig = {
|
||||||
initialized: boolean;
|
initialized: boolean;
|
||||||
allowSignUp: boolean;
|
allowSignUp: boolean;
|
||||||
|
allowedSignUpDomain?: string | null;
|
||||||
isMigrationModeOn?: boolean;
|
isMigrationModeOn?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ export type ServerStatus = {
|
|||||||
date: string;
|
date: string;
|
||||||
message: string;
|
message: string;
|
||||||
emailConfigured: boolean;
|
emailConfigured: boolean;
|
||||||
inviteOnlySignup: boolean;
|
|
||||||
secretScanningConfigured: boolean
|
secretScanningConfigured: boolean
|
||||||
redisConfigured: boolean
|
redisConfigured: boolean
|
||||||
};
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
|
|
||||||
import { useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
@@ -22,6 +22,7 @@ import { deriveArgonKey } from "@app/components/utilities/cryptography/crypto";
|
|||||||
import issueBackupKey from "@app/components/utilities/cryptography/issueBackupKey";
|
import issueBackupKey from "@app/components/utilities/cryptography/issueBackupKey";
|
||||||
import { saveTokenToLocalStorage } from "@app/components/utilities/saveTokenToLocalStorage";
|
import { saveTokenToLocalStorage } from "@app/components/utilities/saveTokenToLocalStorage";
|
||||||
import SecurityClient from "@app/components/utilities/SecurityClient";
|
import SecurityClient from "@app/components/utilities/SecurityClient";
|
||||||
|
import { useServerConfig } from "@app/context";
|
||||||
import { completeAccountSignupInvite, verifySignupInvite } from "@app/hooks/api/auth/queries";
|
import { completeAccountSignupInvite, verifySignupInvite } from "@app/hooks/api/auth/queries";
|
||||||
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
|
import { fetchOrganizations } from "@app/hooks/api/organization/queries";
|
||||||
|
|
||||||
@@ -56,6 +57,13 @@ export default function SignupInvite() {
|
|||||||
const token = parsedUrl.token as string;
|
const token = parsedUrl.token as string;
|
||||||
const organizationId = parsedUrl.organization_id as string;
|
const organizationId = parsedUrl.organization_id as string;
|
||||||
const email = (parsedUrl.to as string)?.replace(" ", "+").trim();
|
const email = (parsedUrl.to as string)?.replace(" ", "+").trim();
|
||||||
|
const { config } = useServerConfig();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!config.allowSignUp) {
|
||||||
|
router.push("/login");
|
||||||
|
}
|
||||||
|
}, [config.allowSignUp]);
|
||||||
|
|
||||||
// Verifies if the information that the users entered (name, workspace) is there, and if the password matched the criteria.
|
// Verifies if the information that the users entered (name, workspace) is there, and if the password matched the criteria.
|
||||||
const signupErrorCheck = async () => {
|
const signupErrorCheck = async () => {
|
||||||
|
|||||||
+4
-4
@@ -141,10 +141,10 @@ export const OrgMembersTable = ({ handlePopUpOpen, setCompleteInviteLink }: Prop
|
|||||||
() =>
|
() =>
|
||||||
members?.filter(
|
members?.filter(
|
||||||
({ user: u, inviteEmail }) =>
|
({ user: u, inviteEmail }) =>
|
||||||
u?.firstName?.toLowerCase().includes(searchMemberFilter) ||
|
u?.firstName?.toLowerCase().includes(searchMemberFilter.toLowerCase()) ||
|
||||||
u?.lastName?.toLowerCase().includes(searchMemberFilter) ||
|
u?.lastName?.toLowerCase().includes(searchMemberFilter.toLowerCase()) ||
|
||||||
u?.email?.toLowerCase().includes(searchMemberFilter) ||
|
u?.email?.toLowerCase().includes(searchMemberFilter.toLowerCase()) ||
|
||||||
inviteEmail?.includes(searchMemberFilter)
|
inviteEmail?.includes(searchMemberFilter.toLowerCase())
|
||||||
),
|
),
|
||||||
[members, searchMemberFilter]
|
[members, searchMemberFilter]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -218,10 +218,10 @@ export const MemberListTab = () => {
|
|||||||
() =>
|
() =>
|
||||||
members?.filter(
|
members?.filter(
|
||||||
({ user: u, inviteEmail }) =>
|
({ user: u, inviteEmail }) =>
|
||||||
u?.firstName?.toLowerCase().includes(searchMemberFilter) ||
|
u?.firstName?.toLowerCase().includes(searchMemberFilter.toLowerCase()) ||
|
||||||
u?.lastName?.toLowerCase().includes(searchMemberFilter) ||
|
u?.lastName?.toLowerCase().includes(searchMemberFilter.toLowerCase()) ||
|
||||||
u?.email?.toLowerCase().includes(searchMemberFilter) ||
|
u?.email?.toLowerCase().includes(searchMemberFilter.toLowerCase()) ||
|
||||||
inviteEmail?.includes(searchMemberFilter)
|
inviteEmail?.includes(searchMemberFilter.toLowerCase())
|
||||||
),
|
),
|
||||||
[members, searchMemberFilter]
|
[members, searchMemberFilter]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
Tr
|
Tr
|
||||||
} from "@app/components/v2";
|
} from "@app/components/v2";
|
||||||
// import { UpgradeProjectAlert } from "@app/components/v2/UpgradeProjectAlert";
|
import { UpgradeProjectAlert } from "@app/components/v2/UpgradeProjectAlert";
|
||||||
import { useOrganization, useWorkspace } from "@app/context";
|
import { useOrganization, useWorkspace } from "@app/context";
|
||||||
import {
|
import {
|
||||||
useCreateFolder,
|
useCreateFolder,
|
||||||
@@ -40,8 +40,8 @@ import {
|
|||||||
useGetUserWsKey,
|
useGetUserWsKey,
|
||||||
useUpdateSecretV3
|
useUpdateSecretV3
|
||||||
} from "@app/hooks/api";
|
} from "@app/hooks/api";
|
||||||
|
import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
||||||
|
|
||||||
// import { ProjectVersion } from "@app/hooks/api/workspace/types";
|
|
||||||
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
|
import { FolderBreadCrumbs } from "./components/FolderBreadCrumbs";
|
||||||
import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
|
import { ProjectIndexSecretsSection } from "./components/ProjectIndexSecretsSection";
|
||||||
import { SecretOverviewFolderRow } from "./components/SecretOverviewFolderRow";
|
import { SecretOverviewFolderRow } from "./components/SecretOverviewFolderRow";
|
||||||
@@ -274,60 +274,65 @@ export const SecretOverviewPage = () => {
|
|||||||
<div className="relative right-5 ml-4">
|
<div className="relative right-5 ml-4">
|
||||||
<NavHeader pageName={t("dashboard.title")} isProjectRelated />
|
<NavHeader pageName={t("dashboard.title")} isProjectRelated />
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-6">
|
<div className="space-y-8">
|
||||||
<p className="text-3xl font-semibold text-bunker-100">Secrets Overview</p>
|
<div className="mt-6">
|
||||||
<p className="text-md text-bunker-300">
|
<p className="text-3xl font-semibold text-bunker-100">Secrets Overview</p>
|
||||||
Inject your secrets using
|
<p className="text-md text-bunker-300">
|
||||||
<a
|
Inject your secrets using
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/cli/overview"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/cli/overview"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
Infisical CLI
|
>
|
||||||
</a>
|
Infisical CLI
|
||||||
,
|
</a>
|
||||||
<a
|
,
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/documentation/getting-started/api"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/documentation/getting-started/api"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
Infisical API
|
>
|
||||||
</a>
|
Infisical API
|
||||||
,
|
</a>
|
||||||
<a
|
,
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/sdks/overview"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/sdks/overview"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
Infisical SDKs
|
>
|
||||||
</a>
|
Infisical SDKs
|
||||||
, and
|
</a>
|
||||||
<a
|
, and
|
||||||
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
<a
|
||||||
href="https://infisical.com/docs/documentation/getting-started/introduction"
|
className="ml-1 text-mineshaft-300 underline decoration-primary-800 underline-offset-4 duration-200 hover:text-mineshaft-100 hover:decoration-primary-600"
|
||||||
target="_blank"
|
href="https://infisical.com/docs/documentation/getting-started/introduction"
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
more
|
>
|
||||||
</a>
|
more
|
||||||
.
|
</a>
|
||||||
</p>
|
.
|
||||||
</div>
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{currentWorkspace?.version === ProjectVersion.V1 && (
|
||||||
|
<UpgradeProjectAlert project={currentWorkspace} />
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="mt-8 flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<FolderBreadCrumbs secretPath={secretPath} onResetSearch={handleResetSearch} />
|
<FolderBreadCrumbs secretPath={secretPath} onResetSearch={handleResetSearch} />
|
||||||
<div className="w-80">
|
<div className="w-80">
|
||||||
<Input
|
<Input
|
||||||
className="h-[2.3rem] bg-mineshaft-800 placeholder-mineshaft-50 duration-200 focus:bg-mineshaft-700/80"
|
className="h-[2.3rem] bg-mineshaft-800 placeholder-mineshaft-50 duration-200 focus:bg-mineshaft-700/80"
|
||||||
placeholder="Search by secret/folder name..."
|
placeholder="Search by secret/folder name..."
|
||||||
value={searchFilter}
|
value={searchFilter}
|
||||||
onChange={(e) => setSearchFilter(e.target.value)}
|
onChange={(e) => setSearchFilter(e.target.value)}
|
||||||
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
|
leftIcon={<FontAwesomeIcon icon={faMagnifyingGlass} />}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="thin-scrollbar mt-4" ref={parentTableRef}>
|
<div className="thin-scrollbar mt-4" ref={parentTableRef}>
|
||||||
|
|||||||
@@ -1,7 +1,24 @@
|
|||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
|
import { faAt } from "@fortawesome/free-solid-svg-icons";
|
||||||
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||||
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
import { ContentLoader, Switch, Tab, TabList, TabPanel, Tabs } from "@app/components/v2";
|
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
|
||||||
|
import {
|
||||||
|
Button,
|
||||||
|
ContentLoader,
|
||||||
|
FormControl,
|
||||||
|
Input,
|
||||||
|
Select,
|
||||||
|
SelectItem,
|
||||||
|
Tab,
|
||||||
|
TabList,
|
||||||
|
TabPanel,
|
||||||
|
Tabs
|
||||||
|
} from "@app/components/v2";
|
||||||
import { useOrganization, useServerConfig, useUser } from "@app/context";
|
import { useOrganization, useServerConfig, useUser } from "@app/context";
|
||||||
import { useUpdateServerConfig } from "@app/hooks/api";
|
import { useUpdateServerConfig } from "@app/hooks/api";
|
||||||
|
|
||||||
@@ -9,16 +26,47 @@ enum TabSections {
|
|||||||
Settings = "settings"
|
Settings = "settings"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum SignUpModes {
|
||||||
|
Disabled = "disabled",
|
||||||
|
Anyone = "anyone"
|
||||||
|
}
|
||||||
|
|
||||||
|
const formSchema = z.object({
|
||||||
|
signUpMode: z.nativeEnum(SignUpModes),
|
||||||
|
allowedSignUpDomain: z.string().optional().nullable()
|
||||||
|
});
|
||||||
|
|
||||||
|
type TDashboardForm = z.infer<typeof formSchema>;
|
||||||
export const AdminDashboardPage = () => {
|
export const AdminDashboardPage = () => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const data = useServerConfig();
|
const data = useServerConfig();
|
||||||
const { config } = data;
|
const { config } = data;
|
||||||
|
|
||||||
|
const {
|
||||||
|
control,
|
||||||
|
handleSubmit,
|
||||||
|
watch,
|
||||||
|
formState: { isSubmitting, isDirty }
|
||||||
|
} = useForm<TDashboardForm>({
|
||||||
|
resolver: zodResolver(formSchema),
|
||||||
|
values: {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
signUpMode: config.allowSignUp ? SignUpModes.Anyone : SignUpModes.Disabled,
|
||||||
|
allowedSignUpDomain: config.allowedSignUpDomain
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const signupMode = watch("signUpMode");
|
||||||
|
|
||||||
const { user, isLoading: isUserLoading } = useUser();
|
const { user, isLoading: isUserLoading } = useUser();
|
||||||
const { orgs } = useOrganization();
|
const { orgs } = useOrganization();
|
||||||
const { mutate: updateServerConfig } = useUpdateServerConfig();
|
const { mutateAsync: updateServerConfig } = useUpdateServerConfig();
|
||||||
|
|
||||||
|
const { createNotification } = useNotificationContext();
|
||||||
|
|
||||||
const isNotAllowed = !user?.superAdmin;
|
const isNotAllowed = !user?.superAdmin;
|
||||||
|
|
||||||
|
// TODO(akhilmhdh): on nextjs 14 roadmap this will be properly addressed with context split
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (isNotAllowed && !isUserLoading) {
|
if (isNotAllowed && !isUserLoading) {
|
||||||
if (orgs?.length) {
|
if (orgs?.length) {
|
||||||
@@ -28,37 +76,115 @@ export const AdminDashboardPage = () => {
|
|||||||
}
|
}
|
||||||
}, [isNotAllowed, isUserLoading]);
|
}, [isNotAllowed, isUserLoading]);
|
||||||
|
|
||||||
|
const onFormSubmit = async (formData: TDashboardForm) => {
|
||||||
|
try {
|
||||||
|
const { signUpMode, allowedSignUpDomain } = formData;
|
||||||
|
await updateServerConfig({
|
||||||
|
allowSignUp: signUpMode !== SignUpModes.Disabled,
|
||||||
|
allowedSignUpDomain: signUpMode === SignUpModes.Anyone ? allowedSignUpDomain : null
|
||||||
|
});
|
||||||
|
createNotification({
|
||||||
|
text: "Successfully changed sign up setting.",
|
||||||
|
type: "success"
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
createNotification({
|
||||||
|
type: "error",
|
||||||
|
text: "Failed to update sign up setting."
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="container mx-auto max-w-7xl pb-12 text-white dark:[color-scheme:dark]">
|
<div className="container mx-auto max-w-7xl px-4 pb-12 text-white dark:[color-scheme:dark]">
|
||||||
<div className="mx-auto mb-6 w-full max-w-7xl py-6 px-6">
|
<div className="mx-auto mb-6 w-full max-w-7xl pt-6">
|
||||||
<div className="mb-8 flex flex-col items-start justify-between text-xl">
|
<div className="mb-8 flex flex-col items-start justify-between text-xl">
|
||||||
<h1 className="text-3xl font-semibold">Admin Dashboard</h1>
|
<h1 className="text-3xl font-semibold">Admin Dashboard</h1>
|
||||||
<p className="text-base text-bunker-300">Manage your Infisical instance.</p>
|
<p className="text-base text-bunker-300">Manage your Infisical instance.</p>
|
||||||
</div>
|
</div>
|
||||||
{isUserLoading || isNotAllowed ? (
|
|
||||||
<ContentLoader text={isNotAllowed ? "Redirecting to org page..." : undefined} />
|
|
||||||
) : (
|
|
||||||
<div>
|
|
||||||
<Tabs defaultValue={TabSections.Settings}>
|
|
||||||
<TabList>
|
|
||||||
<div className="flex w-full flex-row border-b border-mineshaft-600">
|
|
||||||
<Tab value={TabSections.Settings}>General</Tab>
|
|
||||||
</div>
|
|
||||||
</TabList>
|
|
||||||
<TabPanel value={TabSections.Settings}>
|
|
||||||
<div className="flex items-center space-x-4">
|
|
||||||
<Switch
|
|
||||||
id="disable-invite"
|
|
||||||
isChecked={Boolean(config?.allowSignUp)}
|
|
||||||
onCheckedChange={(isChecked) => updateServerConfig({ allowSignUp: isChecked })}
|
|
||||||
/>
|
|
||||||
<div className="flex-grow">Enable signup or invite</div>
|
|
||||||
</div>
|
|
||||||
</TabPanel>
|
|
||||||
</Tabs>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
{isUserLoading || isNotAllowed ? (
|
||||||
|
<ContentLoader text={isNotAllowed ? "Redirecting to org page..." : undefined} />
|
||||||
|
) : (
|
||||||
|
<div>
|
||||||
|
<Tabs defaultValue={TabSections.Settings}>
|
||||||
|
<TabList>
|
||||||
|
<div className="flex w-full flex-row border-b border-mineshaft-600">
|
||||||
|
<Tab value={TabSections.Settings}>General</Tab>
|
||||||
|
</div>
|
||||||
|
</TabList>
|
||||||
|
<TabPanel value={TabSections.Settings}>
|
||||||
|
<form
|
||||||
|
className="mb-6 rounded-lg border border-mineshaft-600 bg-mineshaft-900 p-4"
|
||||||
|
onSubmit={handleSubmit(onFormSubmit)}
|
||||||
|
>
|
||||||
|
<div className="flex justify-between">
|
||||||
|
<div className="mb-4 text-xl font-semibold text-mineshaft-100">
|
||||||
|
Allow user sign up
|
||||||
|
</div>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
name="signUpMode"
|
||||||
|
render={({ field: { onChange, ...field }, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
className="max-w-72 w-72"
|
||||||
|
errorText={error?.message}
|
||||||
|
isError={Boolean(error)}
|
||||||
|
>
|
||||||
|
<Select
|
||||||
|
className="w-72 bg-mineshaft-700"
|
||||||
|
dropdownContainerClassName="bg-mineshaft-700"
|
||||||
|
defaultValue={field.value}
|
||||||
|
onValueChange={(e) => onChange(e)}
|
||||||
|
{...field}
|
||||||
|
>
|
||||||
|
<SelectItem value={SignUpModes.Disabled}>Disabled</SelectItem>
|
||||||
|
<SelectItem value={SignUpModes.Anyone}>Anyone</SelectItem>
|
||||||
|
</Select>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{signupMode === "anyone" && (
|
||||||
|
<div className="mt-4 flex items-center justify-between">
|
||||||
|
<div className="mb-4 flex text-mineshaft-100">
|
||||||
|
Restrict sign up by email domain(s)
|
||||||
|
</div>
|
||||||
|
<Controller
|
||||||
|
control={control}
|
||||||
|
defaultValue=""
|
||||||
|
name="allowedSignUpDomain"
|
||||||
|
render={({ field, fieldState: { error } }) => (
|
||||||
|
<FormControl
|
||||||
|
label="Leave blank to allow any email domains"
|
||||||
|
className="w-72"
|
||||||
|
isError={Boolean(error)}
|
||||||
|
errorText={error?.message}
|
||||||
|
>
|
||||||
|
<Input
|
||||||
|
{...field}
|
||||||
|
value={field.value || ""}
|
||||||
|
placeholder="gmail.com, aws.com, redhat.com"
|
||||||
|
leftIcon={<FontAwesomeIcon icon={faAt} />}
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
<Button
|
||||||
|
type="submit"
|
||||||
|
isLoading={isSubmitting}
|
||||||
|
isDisabled={isSubmitting || !isDirty}
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</TabPanel>
|
||||||
|
</Tabs>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user