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
PR fix suggestions
carlosmonastyrskif08de1599ddf
diff --git a/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-schemas.ts b/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-schemas.tsindex 514ea815d9..af5448467a 100644--- a/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-schemas.ts+++ b/backend/src/ee/services/secret-rotation-v2/azure-client-secret/azure-client-secret-rotation-schemas.ts@@ -20,7 +20,7 @@ export const AzureClientSecretRotationGeneratedCredentialsSchema = z.max(2);const AzureClientSecretRotationParametersSchema = z.object({- appId: z.string().trim().min(1, "Client ID Required").describe(SecretRotations.PARAMETERS.AZURE_CLIENT_SECRET.appId),+ appId: z.string().trim().min(1, "App ID Required").describe(SecretRotations.PARAMETERS.AZURE_CLIENT_SECRET.appId),appName: z.string().trim()diff --git a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.tsindex 4e585ce276..63eb5d6a36 100644--- a/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts+++ b/backend/src/ee/services/secret-rotation-v2/secret-rotation-v2-maps.ts@@ -3,7 +3,7 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enumsexport const SECRET_ROTATION_NAME_MAP: Record<SecretRotation, string> = {[SecretRotation.PostgresCredentials]: "PostgreSQL Credentials",- [SecretRotation.MsSqlCredentials]: "Microsoft SQL Sever Credentials",+ [SecretRotation.MsSqlCredentials]: "Microsoft SQL Server Credentials",[SecretRotation.Auth0ClientSecret]: "Auth0 Client Secret",[SecretRotation.AzureClientSecret]: "Azure Client Secret"};diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.tsindex 4abffb478b..179326cca4 100644--- a/backend/src/server/routes/v1/app-connection-routers/index.ts+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts@@ -25,6 +25,7 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.GCP]: registerGcpConnectionRouter,[AppConnection.AzureKeyVault]: registerAzureKeyVaultConnectionRouter,[AppConnection.AzureAppConfiguration]: registerAzureAppConfigurationConnectionRouter,+ [AppConnection.AzureClientSecrets]: registerAzureClientSecretsConnectionRouter,[AppConnection.Databricks]: registerDatabricksConnectionRouter,[AppConnection.Humanitec]: registerHumanitecConnectionRouter,[AppConnection.TerraformCloud]: registerTerraformCloudConnectionRouter,@@ -32,7 +33,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:[AppConnection.Postgres]: registerPostgresConnectionRouter,[AppConnection.MsSql]: registerMsSqlConnectionRouter,[AppConnection.Camunda]: registerCamundaConnectionRouter,- [AppConnection.AzureClientSecrets]: registerAzureClientSecretsConnectionRouter,[AppConnection.Windmill]: registerWindmillConnectionRouter,[AppConnection.Auth0]: registerAuth0ConnectionRouter};diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.tsindex 2f62638935..622c8a2bc3 100644--- a/backend/src/services/app-connection/app-connection-fns.ts+++ b/backend/src/services/app-connection/app-connection-fns.ts@@ -134,6 +134,8 @@ export const validateAppConnectionCredentials = async ([AppConnection.AzureKeyVault]: validateAzureKeyVaultConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.AzureAppConfiguration]:validateAzureAppConfigurationConnectionCredentials as TAppConnectionCredentialsValidator,+ [AppConnection.AzureClientSecrets]:+ validateAzureClientSecretsConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Humanitec]: validateHumanitecConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Postgres]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.MsSql]: validateSqlConnectionCredentials as TAppConnectionCredentialsValidator,@@ -141,8 +143,6 @@ export const validateAppConnectionCredentials = async ([AppConnection.Vercel]: validateVercelConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.TerraformCloud]: validateTerraformCloudConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Auth0]: validateAuth0ConnectionCredentials as TAppConnectionCredentialsValidator,- [AppConnection.AzureClientSecrets]:- validateAzureClientSecretsConnectionCredentials as TAppConnectionCredentialsValidator,[AppConnection.Windmill]: validateWindmillConnectionCredentials as TAppConnectionCredentialsValidator};diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.tsindex e9f9cc52d5..a38f02768e 100644--- a/backend/src/services/app-connection/app-connection-service.ts+++ b/backend/src/services/app-connection/app-connection-service.ts@@ -452,8 +452,8 @@ export const appConnectionServiceFactory = ({terraformCloud: terraformCloudConnectionService(connectAppConnectionById),camunda: camundaConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),vercel: vercelConnectionService(connectAppConnectionById),- auth0: auth0ConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),azureClientSecrets: azureClientSecretsConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),+ auth0: auth0ConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),windmill: windmillConnectionService(connectAppConnectionById)};};diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.tsindex 24c023dfb1..bff4caf33c 100644--- a/backend/src/services/app-connection/app-connection-types.ts+++ b/backend/src/services/app-connection/app-connection-types.ts@@ -145,12 +145,12 @@ export type TAppConnectionConfig =| TGcpConnectionConfig| TAzureKeyVaultConnectionConfig| TAzureAppConfigurationConnectionConfig+ | TAzureClientSecretsConnectionConfig| TDatabricksConnectionConfig| THumanitecConnectionConfig| TTerraformCloudConnectionConfig| TSqlConnectionConfig| TCamundaConnectionConfig- | TAzureClientSecretsConnectionConfig| TVercelConnectionConfig| TWindmillConnectionConfig| TAuth0ConnectionConfig;@@ -161,6 +161,7 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateGcpConnectionCredentialsSchema| TValidateAzureKeyVaultConnectionCredentialsSchema| TValidateAzureAppConfigurationConnectionCredentialsSchema+ | TValidateAzureClientSecretsConnectionCredentialsSchema| TValidateDatabricksConnectionCredentialsSchema| TValidateHumanitecConnectionCredentialsSchema| TValidatePostgresConnectionCredentialsSchema@@ -168,7 +169,6 @@ export type TValidateAppConnectionCredentialsSchema =| TValidateCamundaConnectionCredentialsSchema| TValidateVercelConnectionCredentialsSchema| TValidateTerraformCloudConnectionCredentialsSchema- | TValidateAzureClientSecretsConnectionCredentialsSchema| TValidateWindmillConnectionCredentialsSchema| TValidateAuth0ConnectionCredentialsSchema;diff --git a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-fns.ts b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-fns.tsindex 580e42fd71..be07a33a0d 100644--- a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-fns.ts+++ b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-fns.ts@@ -31,6 +31,8 @@ export const getAzureClientSecretsConnectionListItem = () => {};};+const EXPIRATION_TIME = 300000;+export const getAzureConnectionAccessToken = async (connectionId: string,appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">,@@ -62,9 +64,10 @@ export const getAzureConnectionAccessToken = async (})) as TAzureClientSecretsConnectionCredentials;const { expiresAt, refreshToken } = credentials;+ const currentTime = Date.now();// get new token if expired or less than 5 minutes until expiry- if (Date.now() < expiresAt - 300000) {+ if (currentTime < expiresAt - EXPIRATION_TIME) {return credentials.accessToken;}@@ -82,7 +85,7 @@ export const getAzureConnectionAccessToken = async (const updatedCredentials = {...credentials,accessToken: data.access_token,- expiresAt: Date.now() + data.expires_in * 1000,+ expiresAt: currentTime + data.expires_in * 1000,refreshToken: data.refresh_token};@@ -102,6 +105,10 @@ export const validateAzureClientSecretsConnectionCredentials = async (config: TAconst { INF_APP_CONNECTION_AZURE_CLIENT_ID, INF_APP_CONNECTION_AZURE_CLIENT_SECRET, SITE_URL } = getConfig();+ if (!SITE_URL) {+ throw new InternalServerError({ message: "SITE_URL env var is required to complete Azure OAuth flow" });+ }+if (!INF_APP_CONNECTION_AZURE_CLIENT_ID || !INF_APP_CONNECTION_AZURE_CLIENT_SECRET) {throw new InternalServerError({message: `Azure ${getAppConnectionMethodName(method)} environment variables have not been configured`diff --git a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-types.ts b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-types.tsindex 6e75801499..fb20fbaddb 100644--- a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-types.ts+++ b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-types.ts@@ -1,4 +1,4 @@-import z from "zod";+import { z } from "zod";import { DiscriminativePick } from "@app/lib/types";diff --git a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.tsindex ee90b33eec..116597ec42 100644--- a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts+++ b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts@@ -43,7 +43,7 @@ export const getAzureConnectionAccessToken = async (appConnection.app !== AppConnection.AzureAppConfiguration &&appConnection.app !== AppConnection.AzureClientSecrets) {- throw new BadRequestError({ message: `Connection with ID '${connectionId}' is not an Azure Key Vault connection` });+ throw new BadRequestError({ message: `Connection with ID '${connectionId}' is not a valid Azure connection` });}const credentials = (await decryptAppConnectionCredentials({diff --git a/docs/integrations/app-connections/azure-client-secrets.mdx b/docs/integrations/app-connections/azure-client-secrets.mdxindex d18865a6d5..9519b5d31e 100644--- a/docs/integrations/app-connections/azure-client-secrets.mdx+++ b/docs/integrations/app-connections/azure-client-secrets.mdx@@ -1,6 +1,6 @@---title: "Azure Client Secrets Connection"-description: "Learn how to configure a Azure Client Secrets Connection for Infisical."+description: "Learn how to configure an Azure Client Secrets Connection for Infisical."---Infisical currently only supports one method for connecting to Azure, which is OAuth.@@ -32,7 +32,7 @@ Infisical currently only supports one method for connecting to Azure, which is O</Step><Step title="Assign API permissions to the application">- For the Azure Connection to work with Client Secrets, you need to assign multiple permissions to the application.+ For the Azure Connection to work with Client Secrets, you need to assign the following permission to the application.#### Azure Client Secrets permissions@@ -81,10 +81,10 @@ Infisical currently only supports one method for connecting to Azure, which is O</Step><Step title="Grant Access">You will then be redirected to Azure to grant Infisical access to your Azure account. Once granted,- you will redirect you back to Infisical's App Connections page. </Step><Step title="Connection Created">- Your **Azure Client Secrets Connection** is now available for use. + Your **Azure Client Secrets Connection** is now available for use. </Step></Steps>diff --git a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsxindex 77a34d0831..050fed1718 100644--- a/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx+++ b/frontend/src/components/secret-rotations-v2/forms/SecretRotationV2SecretsMappingFields/AzureClientSecretRotationSecretsMappingFields.tsx@@ -43,6 +43,7 @@ export const AzureClientSecretRotationSecretsMappingFields = () => {<Inputvalue={value}onChange={onChange}+ type="password"placeholder={rotationOption?.template.secretsMapping.clientSecret}/></FormControl>diff --git a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts b/frontend/src/components/secret-rotations-v2/forms/schemas/index.tsindex e6b4bad6c2..794377810d 100644--- a/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts+++ b/frontend/src/components/secret-rotations-v2/forms/schemas/index.ts@@ -6,10 +6,10 @@ import { MsSqlCredentialsRotationSchema } from "@app/components/secret-rotationsimport { PostgresCredentialsRotationSchema } from "@app/components/secret-rotations-v2/forms/schemas/postgres-credentials-rotation-schema";const SecretRotationUnionSchema = z.discriminatedUnion("type", [- PostgresCredentialsRotationSchema,- MsSqlCredentialsRotationSchema,Auth0ClientSecretRotationSchema,- AzureClientSecretRotationSchema+ AzureClientSecretRotationSchema,+ PostgresCredentialsRotationSchema,+ MsSqlCredentialsRotationSchema]);export const SecretRotationV2FormSchema = SecretRotationUnionSchema;diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.tsindex dc398d0ab9..047342fb19 100644--- a/frontend/src/hooks/api/appConnections/types/index.ts+++ b/frontend/src/hooks/api/appConnections/types/index.ts@@ -80,6 +80,7 @@ export type TAppConnectionMap = {[AppConnection.GCP]: TGcpConnection;[AppConnection.AzureKeyVault]: TAzureKeyVaultConnection;[AppConnection.AzureAppConfiguration]: TAzureAppConfigurationConnection;+ [AppConnection.AzureClientSecrets]: TAzureClientSecretsConnection;[AppConnection.Databricks]: TDatabricksConnection;[AppConnection.Humanitec]: THumanitecConnection;[AppConnection.TerraformCloud]: TTerraformCloudConnection;@@ -87,7 +88,6 @@ export type TAppConnectionMap = {[AppConnection.Postgres]: TPostgresConnection;[AppConnection.MsSql]: TMsSqlConnection;[AppConnection.Camunda]: TCamundaConnection;- [AppConnection.AzureClientSecrets]: TAzureClientSecretsConnection;[AppConnection.Windmill]: TWindmillConnection;[AppConnection.Auth0]: TAuth0Connection;};diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsxindex e1d978eaca..b7ae7352e4 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureClientSecretsConnectionForm.tsx@@ -83,15 +83,7 @@ export const AzureClientSecretsConnectionForm = ({ appConnection }: Props) => {}};- let isMissingConfig: boolean;-- switch (selectedMethod) {- case AzureClientSecretsConnectionMethod.OAuth:- isMissingConfig = !oauthClientId;- break;- default:- throw new Error(`Unhandled Azure Connection method: ${selectedMethod}`);- }+ const isMissingConfig = !oauthClientId;const methodDetails = getAppConnectionMethodDetails(selectedMethod);