Skip to content

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

refactor(secret-sync): move AKV certificate content types to module scope

Igor Correae7b8e419fe12
diff --git a/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts b/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts
index e96d4d5330..1fecde89c7 100644
--- a/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts
+++ b/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts
@@ -16,9 +16,9 @@ type TAzureKeyVaultSyncFactoryDeps = {
kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
};
-export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzureKeyVaultSyncFactoryDeps) => {
- const AZURE_KEY_VAULT_CERTIFICATE_CONTENT_TYPES = ["application/x-pkcs12", "application/x-pem-file"];
+const AZURE_KEY_VAULT_CERTIFICATE_CONTENT_TYPES = ["application/x-pkcs12", "application/x-pem-file"] as const;
+export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzureKeyVaultSyncFactoryDeps) => {
const $getAzureKeyVaultSecrets = async (
accessToken: string,
vaultBaseUrl: string,
@@ -49,7 +49,10 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzur
// filter them out at the list stage if the option is enabled (avoids fetching their values too)
const visibleSecrets = disableCertificateImport
? getAzureKeyVaultSecrets.filter(
- (secret) => !AZURE_KEY_VAULT_CERTIFICATE_CONTENT_TYPES.includes(secret.contentType ?? "")
+ (secret) =>
+ !AZURE_KEY_VAULT_CERTIFICATE_CONTENT_TYPES.includes(
+ secret.contentType as (typeof AZURE_KEY_VAULT_CERTIFICATE_CONTENT_TYPES)[number]
+ )
)
: getAzureKeyVaultSecrets;