Skip to content

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

review comments

Matheus Nogueiraf6414bfec04e
diff --git a/backend/src/services/app-connection/azure-app-configuration/azure-app-configuration-connection-schemas.ts b/backend/src/services/app-connection/azure-app-configuration/azure-app-configuration-connection-schemas.ts
index 875713c3a6..0e278b8446 100644
--- a/backend/src/services/app-connection/azure-app-configuration/azure-app-configuration-connection-schemas.ts
+++ b/backend/src/services/app-connection/azure-app-configuration/azure-app-configuration-connection-schemas.ts
@@ -74,11 +74,21 @@ export const ValidateAzureAppConfigurationConnectionCredentialsSchema = z.discri
})
]);
-export const CreateAzureAppConfigurationConnectionSchema = ValidateAzureAppConfigurationConnectionCredentialsSchema.and(
- GenericCreateAppConnectionFieldsSchema(AppConnection.AzureAppConfiguration, {
- supportsCredentialRotation: true
- })
-);
+export const CreateAzureAppConfigurationConnectionSchema = ValidateAzureAppConfigurationConnectionCredentialsSchema
+ .and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureAppConfiguration, {
+ supportsCredentialRotation: true
+ })
+ )
+ .superRefine((data, ctx) => {
+ if (data.method !== AzureAppConfigurationConnectionMethod.ClientSecret && data.isAutoRotationEnabled) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Credential rotation is only supported for the client-secret method",
+ path: ["isAutoRotationEnabled"]
+ });
+ }
+ });
export const UpdateAzureAppConfigurationConnectionSchema = z
.object({
diff --git a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts
index 880b48ce2d..cd55943dc2 100644
--- a/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts
+++ b/backend/src/services/app-connection/azure-client-secrets/azure-client-secrets-connection-schemas.ts
@@ -126,9 +126,19 @@ export const ValidateAzureClientSecretsConnectionCredentialsSchema = z.discrimin
})
]);
-export const CreateAzureClientSecretsConnectionSchema = ValidateAzureClientSecretsConnectionCredentialsSchema.and(
- GenericCreateAppConnectionFieldsSchema(AppConnection.AzureClientSecrets, { supportsCredentialRotation: true })
-);
+export const CreateAzureClientSecretsConnectionSchema = ValidateAzureClientSecretsConnectionCredentialsSchema
+ .and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureClientSecrets, { supportsCredentialRotation: true })
+ )
+ .superRefine((data, ctx) => {
+ if (data.method !== AzureClientSecretsConnectionMethod.ClientSecret && data.isAutoRotationEnabled) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Credential rotation is only supported for the client-secret method",
+ path: ["isAutoRotationEnabled"]
+ });
+ }
+ });
export const UpdateAzureClientSecretsConnectionSchema = z
.object({
diff --git a/backend/src/services/app-connection/azure-devops/azure-devops-fns.ts b/backend/src/services/app-connection/azure-devops/azure-devops-fns.ts
index 0bd2188ac8..8c0586adf7 100644
--- a/backend/src/services/app-connection/azure-devops/azure-devops-fns.ts
+++ b/backend/src/services/app-connection/azure-devops/azure-devops-fns.ts
@@ -317,11 +317,12 @@ export const validateAzureDevOpsConnectionCredentials = async (config: TAzureDev
}
case AzureDevOpsConnectionMethod.ClientSecret:
- const { tenantId, clientId, clientSecret, orgName } = inputCredentials as {
+ const { tenantId, clientId, clientSecret, orgName, clientSecretKeyId } = inputCredentials as {
tenantId: string;
clientId: string;
clientSecret: string;
orgName: string;
+ clientSecretKeyId?: string;
};
try {
@@ -357,6 +358,7 @@ export const validateAzureDevOpsConnectionCredentials = async (config: TAzureDev
clientId,
clientSecret,
orgName,
+ clientSecretKeyId,
accessToken: clientData.access_token,
expiresAt: Date.now() + clientData.expires_in * 1000
};
diff --git a/backend/src/services/app-connection/azure-devops/azure-devops-schemas.ts b/backend/src/services/app-connection/azure-devops/azure-devops-schemas.ts
index f9a6ab9bdd..e22240b9dc 100644
--- a/backend/src/services/app-connection/azure-devops/azure-devops-schemas.ts
+++ b/backend/src/services/app-connection/azure-devops/azure-devops-schemas.ts
@@ -79,6 +79,7 @@ export const AzureDevOpsConnectionClientSecretOutputCredentialsSchema = z.object
clientSecret: z.string(),
tenantId: z.string(),
orgName: z.string(),
+ clientSecretKeyId: z.string().optional(),
accessToken: z.string(),
expiresAt: z.number()
});
@@ -110,11 +111,21 @@ export const ValidateAzureDevOpsConnectionCredentialsSchema = z.discriminatedUni
})
]);
-export const CreateAzureDevOpsConnectionSchema = ValidateAzureDevOpsConnectionCredentialsSchema.and(
- GenericCreateAppConnectionFieldsSchema(AppConnection.AzureDevOps, {
- supportsCredentialRotation: true
- })
-);
+export const CreateAzureDevOpsConnectionSchema = ValidateAzureDevOpsConnectionCredentialsSchema
+ .and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureDevOps, {
+ supportsCredentialRotation: true
+ })
+ )
+ .superRefine((data, ctx) => {
+ if (data.method !== AzureDevOpsConnectionMethod.ClientSecret && data.isAutoRotationEnabled) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Credential rotation is only supported for the client-secret method",
+ path: ["isAutoRotationEnabled"]
+ });
+ }
+ });
export const UpdateAzureDevOpsConnectionSchema = z
.object({
diff --git a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts
index c1b5f020a9..f224938ab2 100644
--- a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts
+++ b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts
@@ -98,12 +98,22 @@ export const ValidateAzureKeyVaultConnectionCredentialsSchema = z.discriminatedU
})
]);
-export const CreateAzureKeyVaultConnectionSchema = ValidateAzureKeyVaultConnectionCredentialsSchema.and(
- GenericCreateAppConnectionFieldsSchema(AppConnection.AzureKeyVault, {
- supportsCredentialRotation: true,
- supportsGateways: true
- })
-);
+export const CreateAzureKeyVaultConnectionSchema = ValidateAzureKeyVaultConnectionCredentialsSchema
+ .and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureKeyVault, {
+ supportsCredentialRotation: true,
+ supportsGateways: true
+ })
+ )
+ .superRefine((data, ctx) => {
+ if (data.method !== AzureKeyVaultConnectionMethod.ClientSecret && data.isAutoRotationEnabled) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: "Credential rotation is only supported for the client-secret method",
+ path: ["isAutoRotationEnabled"]
+ });
+ }
+ });
export const UpdateAzureKeyVaultConnectionSchema = z
.object({