Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix: validation

varonix4dc3f9fc16e5
diff --git a/frontend/src/hooks/api/dynamicSecret/queries.ts b/frontend/src/hooks/api/dynamicSecret/queries.ts
index 21f547b68b..3cd91e2dfb 100644
--- a/frontend/src/hooks/api/dynamicSecret/queries.ts
+++ b/frontend/src/hooks/api/dynamicSecret/queries.ts
@@ -7,6 +7,10 @@ import {
TDetailsDynamicSecretDTO,
TDynamicSecret,
TGetDynamicSecretsByEnvsDTO,
+ TGetEntraIdUsersDTO,
+ TGetIbmApiConnectOrgAppsDTO,
+ TGetIbmApiConnectOrgCatalogsDTO,
+ TGetIbmApiConnectOrgsDTO,
TListDynamicSecretDTO
} from "./types";
@@ -20,7 +24,48 @@ export const dynamicSecretKeys = {
details: ({ path, environmentSlug, projectSlug, name }: TDetailsDynamicSecretDTO) =>
[{ projectSlug, path, environmentSlug, name }, "dynamic-secret-details"] as const,
sshCaPublicKey: (dynamicSecretId: string) =>
- [{ dynamicSecretId }, "dynamic-secret-ssh-ca-public-key"] as const
+ [{ dynamicSecretId }, "dynamic-secret-ssh-ca-public-key"] as const,
+ entraIdUsers: ({ projectSlug, tenantId, applicationId, clientSecret }: TGetEntraIdUsersDTO) =>
+ [
+ { projectSlug, tenantId, applicationId, clientSecret },
+ "dynamic-secret-entra-id-users"
+ ] as const,
+ ibmApiConnectOrgs: ({
+ projectSlug,
+ instanceUrl,
+ apiKey,
+ clientId,
+ clientSecret
+ }: TGetIbmApiConnectOrgsDTO) =>
+ [
+ { projectSlug, instanceUrl, apiKey, clientId, clientSecret },
+ "dynamic-secret-ibm-api-connect-orgs"
+ ] as const,
+ ibmApiConnectOrgCatalogs: ({
+ projectSlug,
+ instanceUrl,
+ apiKey,
+ clientId,
+ clientSecret,
+ orgId
+ }: TGetIbmApiConnectOrgCatalogsDTO) =>
+ [
+ { projectSlug, instanceUrl, apiKey, clientId, clientSecret, orgId },
+ "dynamic-secret-ibm-api-connect-org-catalogs"
+ ] as const,
+ ibmApiConnectOrgApps: ({
+ projectSlug,
+ instanceUrl,
+ apiKey,
+ clientId,
+ clientSecret,
+ orgId,
+ catalogId
+ }: TGetIbmApiConnectOrgAppsDTO) =>
+ [
+ { projectSlug, instanceUrl, apiKey, clientId, clientSecret, orgId, catalogId },
+ "dynamic-secret-ibm-api-connect-org-apps"
+ ] as const
};
export const useGetDynamicSecrets = ({
@@ -79,15 +124,14 @@ export const useGetDynamicSecretProviderData = ({
clientSecret,
projectSlug,
enabled
-}: {
- tenantId: string;
- applicationId: string;
- clientSecret: string;
- projectSlug: string;
- enabled: boolean;
-}) => {
+}: TGetEntraIdUsersDTO & { enabled: boolean }) => {
return useQuery({
- queryKey: ["users"],
+ queryKey: dynamicSecretKeys.entraIdUsers({
+ projectSlug,
+ tenantId,
+ applicationId,
+ clientSecret
+ }),
queryFn: async () => {
const { data } = await apiRequest.post<{ id: string; email: string; name: string }[]>(
"/api/v1/dynamic-secrets/entra-id/users",
@@ -111,16 +155,15 @@ export const useGetIbmApiConnectOrgs = ({
clientSecret,
projectSlug,
enabled
-}: {
- instanceUrl: string;
- apiKey: string;
- clientId: string;
- clientSecret: string;
- projectSlug: string;
- enabled: boolean;
-}) => {
+}: TGetIbmApiConnectOrgsDTO & { enabled: boolean }) => {
return useQuery({
- queryKey: ["ibm-api-connect-orgs", instanceUrl, apiKey, clientId, clientSecret],
+ queryKey: dynamicSecretKeys.ibmApiConnectOrgs({
+ projectSlug,
+ instanceUrl,
+ apiKey,
+ clientId,
+ clientSecret
+ }),
queryFn: async () => {
const { data } = await apiRequest.post<{ name: string; title: string; id: string }[]>(
"/api/v1/dynamic-secrets/ibm-api-connect/orgs",
@@ -140,17 +183,16 @@ export const useGetIbmApiConnectOrgCatalogs = ({
orgId,
projectSlug,
enabled
-}: {
- instanceUrl: string;
- apiKey: string;
- clientId: string;
- clientSecret: string;
- orgId: string;
- projectSlug: string;
- enabled: boolean;
-}) => {
+}: TGetIbmApiConnectOrgCatalogsDTO & { enabled: boolean }) => {
return useQuery({
- queryKey: ["ibm-api-connect-org-catalogs", instanceUrl, apiKey, clientId, clientSecret, orgId],
+ queryKey: dynamicSecretKeys.ibmApiConnectOrgCatalogs({
+ projectSlug,
+ instanceUrl,
+ apiKey,
+ clientId,
+ clientSecret,
+ orgId
+ }),
queryFn: async () => {
const { data } = await apiRequest.post<{ name: string; title: string; id: string }[]>(
`/api/v1/dynamic-secrets/ibm-api-connect/orgs/${orgId}/catalogs`,
@@ -171,26 +213,17 @@ export const useGetIbmApiConnectOrgApps = ({
catalogId,
projectSlug,
enabled
-}: {
- instanceUrl: string;
- apiKey: string;
- clientId: string;
- clientSecret: string;
- orgId: string;
- catalogId: string;
- projectSlug: string;
- enabled: boolean;
-}) => {
+}: TGetIbmApiConnectOrgAppsDTO & { enabled: boolean }) => {
return useQuery({
- queryKey: [
- "ibm-api-connect-org-apps",
+ queryKey: dynamicSecretKeys.ibmApiConnectOrgApps({
+ projectSlug,
instanceUrl,
apiKey,
clientId,
clientSecret,
orgId,
catalogId
- ],
+ }),
queryFn: async () => {
const { data } = await apiRequest.post<
{ name: string; title: string; id: string; consumerOrgId: string }[]
diff --git a/frontend/src/hooks/api/dynamicSecret/types.ts b/frontend/src/hooks/api/dynamicSecret/types.ts
index 54f8340390..96860cb4cc 100644
--- a/frontend/src/hooks/api/dynamicSecret/types.ts
+++ b/frontend/src/hooks/api/dynamicSecret/types.ts
@@ -632,3 +632,26 @@ export type TGetDynamicSecretsByEnvsDTO = {
path: string;
environmentSlugs: string[];
};
+
+export type TGetEntraIdUsersDTO = {
+ projectSlug: string;
+ tenantId: string;
+ applicationId: string;
+ clientSecret: string;
+};
+
+export type TGetIbmApiConnectOrgsDTO = {
+ projectSlug: string;
+ instanceUrl: string;
+ apiKey: string;
+ clientId: string;
+ clientSecret: string;
+};
+
+export type TGetIbmApiConnectOrgCatalogsDTO = TGetIbmApiConnectOrgsDTO & {
+ orgId: string;
+};
+
+export type TGetIbmApiConnectOrgAppsDTO = TGetIbmApiConnectOrgCatalogsDTO & {
+ catalogId: string;
+};