Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(SECRETS-511): dynamic secret IBM and azure helpers
varonixe798603ae80b
diff --git a/backend/src/ee/routes/v1/dynamic-secret-router.ts b/backend/src/ee/routes/v1/dynamic-secret-router.tsindex 0122a20920..c59a14fda1 100644--- a/backend/src/ee/routes/v1/dynamic-secret-router.ts+++ b/backend/src/ee/routes/v1/dynamic-secret-router.ts@@ -625,7 +625,10 @@ echo ""instanceUrl: z.string().url().min(1).describe("The IBM API Connect instance URL"),apiKey: z.string().min(1).describe("The IBM API Connect API key"),clientId: z.string().min(1).describe("The IBM API Connect client ID"),- clientSecret: z.string().min(1).describe("The IBM API Connect client secret")+ clientSecret: z.string().min(1).describe("The IBM API Connect client secret"),+ projectSlug: slugSchema({ max: 64, field: "Project slug" }).describe(+ "The slug of the project to configure the dynamic secret in"+ )}),response: {200: z@@ -643,7 +646,12 @@ echo ""instanceUrl: req.body.instanceUrl,apiKey: req.body.apiKey,clientId: req.body.clientId,- clientSecret: req.body.clientSecret+ clientSecret: req.body.clientSecret,+ projectSlug: req.body.projectSlug,+ actor: req.permission.type,+ actorId: req.permission.id,+ actorAuthMethod: req.permission.authMethod,+ actorOrgId: req.permission.orgId});return data;}@@ -663,7 +671,10 @@ echo ""instanceUrl: z.string().url().min(1).describe("The IBM API Connect instance URL"),apiKey: z.string().min(1).describe("The IBM API Connect API key"),clientId: z.string().min(1).describe("The IBM API Connect client ID"),- clientSecret: z.string().min(1).describe("The IBM API Connect client secret")+ clientSecret: z.string().min(1).describe("The IBM API Connect client secret"),+ projectSlug: slugSchema({ max: 64, field: "Project slug" }).describe(+ "The slug of the project to configure the dynamic secret in"+ )}),response: {200: z@@ -682,7 +693,12 @@ echo ""apiKey: req.body.apiKey,clientId: req.body.clientId,clientSecret: req.body.clientSecret,- orgId: req.params.orgId+ orgId: req.params.orgId,+ projectSlug: req.body.projectSlug,+ actor: req.permission.type,+ actorId: req.permission.id,+ actorAuthMethod: req.permission.authMethod,+ actorOrgId: req.permission.orgId});return data;}@@ -703,7 +719,10 @@ echo ""instanceUrl: z.string().url().min(1).describe("The IBM API Connect instance URL"),apiKey: z.string().min(1).describe("The IBM API Connect API key"),clientId: z.string().min(1).describe("The IBM API Connect client ID"),- clientSecret: z.string().min(1).describe("The IBM API Connect client secret")+ clientSecret: z.string().min(1).describe("The IBM API Connect client secret"),+ projectSlug: slugSchema({ max: 64, field: "Project slug" }).describe(+ "The slug of the project to configure the dynamic secret in"+ )}),response: {200: z@@ -724,7 +743,12 @@ echo ""clientId: req.body.clientId,clientSecret: req.body.clientSecret,orgId: req.params.orgId,- catalogId: req.params.catalogId+ catalogId: req.params.catalogId,+ projectSlug: req.body.projectSlug,+ actor: req.permission.type,+ actorId: req.permission.id,+ actorAuthMethod: req.permission.authMethod,+ actorOrgId: req.permission.orgId});return data;}@@ -740,7 +764,10 @@ echo ""body: z.object({tenantId: z.string().min(1).describe("The tenant ID of the Azure Entra ID"),applicationId: z.string().min(1).describe("The application ID of the Azure Entra ID App Registration"),- clientSecret: z.string().min(1).describe("The client secret of the Azure Entra ID App Registration")+ clientSecret: z.string().min(1).describe("The client secret of the Azure Entra ID App Registration"),+ projectSlug: slugSchema({ max: 64, field: "Project slug" }).describe(+ "The slug of the project to configure the dynamic secret in"+ )}),response: {200: z@@ -757,7 +784,12 @@ echo ""const data = await server.services.dynamicSecret.fetchAzureEntraIdUsers({tenantId: req.body.tenantId,applicationId: req.body.applicationId,- clientSecret: req.body.clientSecret+ clientSecret: req.body.clientSecret,+ projectSlug: req.body.projectSlug,+ actor: req.permission.type,+ actorId: req.permission.id,+ actorAuthMethod: req.permission.authMethod,+ actorOrgId: req.permission.orgId});return data;}diff --git a/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts b/backend/src/ee/services/dynamic-secret/dynamic-secret-service.tsindex 47c1cfb407..86854b8568 100644--- a/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts+++ b/backend/src/ee/services/dynamic-secret/dynamic-secret-service.ts@@ -949,8 +949,30 @@ export const dynamicSecretServiceFactory = ({const fetchAzureEntraIdUsers: TDynamicSecretServiceFactory["fetchAzureEntraIdUsers"] = async ({tenantId,applicationId,- clientSecret+ clientSecret,+ projectSlug,+ actor,+ actorId,+ actorAuthMethod,+ actorOrgId}) => {+ const project = await projectDAL.findProjectBySlug(projectSlug, actorOrgId);+ if (!project) throw new NotFoundError({ message: `Project with slug '${projectSlug}' not found` });++ const { permission } = await permissionService.getProjectPermission({+ actor,+ actorId,+ projectId: project.id,+ actorAuthMethod,+ actorOrgId,+ actionProjectType: ActionProjectType.SecretManager+ });++ ForbiddenError.from(permission).throwUnlessCan(+ ProjectPermissionDynamicSecretActions.ReadRootCredential,+ ProjectPermissionSub.DynamicSecrets+ );+const azureEntraIdUsers = await AzureEntraIDProvider().fetchAzureEntraIdUsers(tenantId,applicationId,@@ -963,8 +985,30 @@ export const dynamicSecretServiceFactory = ({instanceUrl,apiKey,clientId,- clientSecret+ clientSecret,+ projectSlug,+ actor,+ actorId,+ actorAuthMethod,+ actorOrgId}) => {+ const project = await projectDAL.findProjectBySlug(projectSlug, actorOrgId);+ if (!project) throw new NotFoundError({ message: `Project with slug '${projectSlug}' not found` });++ const { permission } = await permissionService.getProjectPermission({+ actor,+ actorId,+ projectId: project.id,+ actorAuthMethod,+ actorOrgId,+ actionProjectType: ActionProjectType.SecretManager+ });++ ForbiddenError.from(permission).throwUnlessCan(+ ProjectPermissionDynamicSecretActions.ReadRootCredential,+ ProjectPermissionSub.DynamicSecrets+ );+return IbmApiConnectProvider().fetchOrganizations({ instanceUrl, apiKey, clientId, clientSecret });};@@ -973,8 +1017,30 @@ export const dynamicSecretServiceFactory = ({apiKey,clientId,clientSecret,- orgId+ orgId,+ projectSlug,+ actor,+ actorId,+ actorAuthMethod,+ actorOrgId}) => {+ const project = await projectDAL.findProjectBySlug(projectSlug, actorOrgId);+ if (!project) throw new NotFoundError({ message: `Project with slug '${projectSlug}' not found` });++ const { permission } = await permissionService.getProjectPermission({+ actor,+ actorId,+ projectId: project.id,+ actorAuthMethod,+ actorOrgId,+ actionProjectType: ActionProjectType.SecretManager+ });++ ForbiddenError.from(permission).throwUnlessCan(+ ProjectPermissionDynamicSecretActions.ReadRootCredential,+ ProjectPermissionSub.DynamicSecrets+ );+return IbmApiConnectProvider().fetchOrganizationCatalogs({ instanceUrl, apiKey, clientId, clientSecret }, orgId);};@@ -984,8 +1050,30 @@ export const dynamicSecretServiceFactory = ({clientId,clientSecret,orgId,- catalogId+ catalogId,+ projectSlug,+ actor,+ actorId,+ actorAuthMethod,+ actorOrgId}) => {+ const project = await projectDAL.findProjectBySlug(projectSlug, actorOrgId);+ if (!project) throw new NotFoundError({ message: `Project with slug '${projectSlug}' not found` });++ const { permission } = await permissionService.getProjectPermission({+ actor,+ actorId,+ projectId: project.id,+ actorAuthMethod,+ actorOrgId,+ actionProjectType: ActionProjectType.SecretManager+ });++ ForbiddenError.from(permission).throwUnlessCan(+ ProjectPermissionDynamicSecretActions.ReadRootCredential,+ ProjectPermissionSub.DynamicSecrets+ );+return IbmApiConnectProvider().fetchOrganizationApps({ instanceUrl, apiKey, clientId, clientSecret },orgId,diff --git a/backend/src/ee/services/dynamic-secret/dynamic-secret-types.ts b/backend/src/ee/services/dynamic-secret/dynamic-secret-types.tsindex f38b2ea6cb..2c65e17cb3 100644--- a/backend/src/ee/services/dynamic-secret/dynamic-secret-types.ts+++ b/backend/src/ee/services/dynamic-secret/dynamic-secret-types.ts@@ -59,6 +59,10 @@ export type TGetSshCaPublicKeyDTO = {dynamicSecretId: string;} & Omit<TProjectPermission, "projectId">;+export type TDynamicSecretProviderDiscoveryDTO = {+ projectSlug: string;+} & Omit<TProjectPermission, "projectId">;+export type ListDynamicSecretsFilters = {offset?: number;limit?: number;@@ -118,19 +122,27 @@ export type TDynamicSecretServiceFactory = {) => Promise<Array<TDynamicSecretWithMetadata & { environment: string }>>;getDynamicSecretCount: (arg: TGetDynamicSecretsCountDTO) => Promise<number>;getCountMultiEnv: (arg: TListDynamicSecretsMultiEnvDTO) => Promise<number>;- fetchAzureEntraIdUsers: (arg: { tenantId: string; applicationId: string; clientSecret: string }) => Promise<+ fetchAzureEntraIdUsers: (+ arg: {+ tenantId: string;+ applicationId: string;+ clientSecret: string;+ } & TDynamicSecretProviderDiscoveryDTO+ ) => Promise<{name: string;id: string;email: string;}[]>;- fetchIbmApiConnectOrgs: (arg: TIbmApiConnectBaseCredentials) => Promise<TApiConnectResource[]>;+ fetchIbmApiConnectOrgs: (+ arg: TIbmApiConnectBaseCredentials & TDynamicSecretProviderDiscoveryDTO+ ) => Promise<TApiConnectResource[]>;fetchIbmApiConnectOrgCatalogs: (- arg: TIbmApiConnectBaseCredentials & { orgId: string }+ arg: TIbmApiConnectBaseCredentials & { orgId: string } & TDynamicSecretProviderDiscoveryDTO) => Promise<TApiConnectResource[]>;fetchIbmApiConnectOrgApps: (- arg: TIbmApiConnectBaseCredentials & { orgId: string; catalogId: string }+ arg: TIbmApiConnectBaseCredentials & { orgId: string; catalogId: string } & TDynamicSecretProviderDiscoveryDTO) => Promise<TApiConnectApp[]>;listDynamicSecretsByFolderIds: (arg: TListDynamicSecretsByFolderMappingsDTO,diff --git a/frontend/src/hooks/api/dynamicSecret/queries.ts b/frontend/src/hooks/api/dynamicSecret/queries.tsindex d44a01bb09..21f547b68b 100644--- a/frontend/src/hooks/api/dynamicSecret/queries.ts+++ b/frontend/src/hooks/api/dynamicSecret/queries.ts@@ -77,11 +77,13 @@ export const useGetDynamicSecretProviderData = ({tenantId,applicationId,clientSecret,+ projectSlug,enabled}: {tenantId: string;applicationId: string;clientSecret: string;+ projectSlug: string;enabled: boolean;}) => {return useQuery({@@ -92,7 +94,8 @@ export const useGetDynamicSecretProviderData = ({{tenantId,applicationId,- clientSecret+ clientSecret,+ projectSlug});return data;@@ -106,12 +109,14 @@ export const useGetIbmApiConnectOrgs = ({apiKey,clientId,clientSecret,+ projectSlug,enabled}: {instanceUrl: string;apiKey: string;clientId: string;clientSecret: string;+ projectSlug: string;enabled: boolean;}) => {return useQuery({@@ -119,7 +124,7 @@ export const useGetIbmApiConnectOrgs = ({queryFn: async () => {const { data } = await apiRequest.post<{ name: string; title: string; id: string }[]>("/api/v1/dynamic-secrets/ibm-api-connect/orgs",- { instanceUrl, apiKey, clientId, clientSecret }+ { instanceUrl, apiKey, clientId, clientSecret, projectSlug });return data;},@@ -133,6 +138,7 @@ export const useGetIbmApiConnectOrgCatalogs = ({clientId,clientSecret,orgId,+ projectSlug,enabled}: {instanceUrl: string;@@ -140,6 +146,7 @@ export const useGetIbmApiConnectOrgCatalogs = ({clientId: string;clientSecret: string;orgId: string;+ projectSlug: string;enabled: boolean;}) => {return useQuery({@@ -147,7 +154,7 @@ export const useGetIbmApiConnectOrgCatalogs = ({queryFn: async () => {const { data } = await apiRequest.post<{ name: string; title: string; id: string }[]>(`/api/v1/dynamic-secrets/ibm-api-connect/orgs/${orgId}/catalogs`,- { instanceUrl, apiKey, clientId, clientSecret }+ { instanceUrl, apiKey, clientId, clientSecret, projectSlug });return data;},@@ -162,6 +169,7 @@ export const useGetIbmApiConnectOrgApps = ({clientSecret,orgId,catalogId,+ projectSlug,enabled}: {instanceUrl: string;@@ -170,6 +178,7 @@ export const useGetIbmApiConnectOrgApps = ({clientSecret: string;orgId: string;catalogId: string;+ projectSlug: string;enabled: boolean;}) => {return useQuery({@@ -189,7 +198,8 @@ export const useGetIbmApiConnectOrgApps = ({instanceUrl,apiKey,clientId,- clientSecret+ clientSecret,+ projectSlug});return data;},diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsxindex b4506c51a9..f707fd09e6 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/AzureEntraIdInputForm.tsx@@ -95,6 +95,7 @@ export const AzureEntraIdInputForm = ({tenantId,applicationId,clientSecret,+ projectSlug,enabled: !!configurationComplete});const loading = configurationComplete && isFetching;diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/IbmApiConnectInputForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/IbmApiConnectInputForm.tsxindex 272744dde2..efd7d81c9d 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/IbmApiConnectInputForm.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/ActionBar/CreateDynamicSecretForm/IbmApiConnectInputForm.tsx@@ -119,6 +119,7 @@ export const IbmApiConnectInputForm = ({apiKey: apiKey || "",clientId: clientId || "",clientSecret: clientSecret || "",+ projectSlug,enabled: credentialsComplete});@@ -134,6 +135,7 @@ export const IbmApiConnectInputForm = ({clientId: clientId || "",clientSecret: clientSecret || "",orgId: selectedOrg?.id || "",+ projectSlug,enabled: orgSelected});@@ -150,6 +152,7 @@ export const IbmApiConnectInputForm = ({clientSecret: clientSecret || "",orgId: selectedOrg?.id || "",catalogId: selectedCatalog?.id || "",+ projectSlug,enabled: catalogSelected});diff --git a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretIbmApiConnectForm.tsx b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretIbmApiConnectForm.tsxindex 49e8c168fb..a7bd20c666 100644--- a/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretIbmApiConnectForm.tsx+++ b/frontend/src/pages/secret-manager/SecretDashboardPage/components/DynamicSecretListView/EditDynamicSecretForm/EditDynamicSecretIbmApiConnectForm.tsx@@ -121,6 +121,7 @@ export const EditDynamicSecretIbmApiConnectForm = ({apiKey: apiKey || "",clientId: clientId || "",clientSecret: clientSecret || "",+ projectSlug,enabled: credentialsComplete});@@ -136,6 +137,7 @@ export const EditDynamicSecretIbmApiConnectForm = ({clientId: clientId || "",clientSecret: clientSecret || "",orgId: selectedOrg?.id || "",+ projectSlug,enabled: orgSelected});@@ -152,6 +154,7 @@ export const EditDynamicSecretIbmApiConnectForm = ({clientSecret: clientSecret || "",orgId: selectedOrg?.id || "",catalogId: selectedCatalog?.id || "",+ projectSlug,enabled: catalogSelected});