Skip to content

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

fix(external-infisical): replace non-null assertions with explicit InternalServerError guard for identityUaDAL dep

Igor Correa4fd4ce4f7437
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index 9335f85c87..9d19404de5 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -16,7 +16,7 @@ import { TLicenseServiceFactory } from "@app/ee/services/license/license-service
import { SECRET_ROTATION_CONNECTION_MAP } from "@app/ee/services/secret-rotation-v2/secret-rotation-v2-maps";
import { SECRET_SCANNING_DATA_SOURCE_CONNECTION_MAP } from "@app/ee/services/secret-scanning-v2/secret-scanning-v2-maps";
import { crypto } from "@app/lib/crypto/cryptography";
-import { BadRequestError } from "@app/lib/errors";
+import { BadRequestError, InternalServerError } from "@app/lib/errors";
import { APP_CONNECTION_NAME_MAP, APP_CONNECTION_PLAN_MAP } from "@app/services/app-connection/app-connection-maps";
import {
transferSqlConnectionCredentialsToPlatform,
@@ -424,11 +424,17 @@ export const validateAppConnectionCredentials = async (
[AppConnection.CircleCI]: validateCircleCIConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.AzureEntraId]: validateAzureEntraIdConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Venafi]: validateVenafiConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.ExternalInfisical]: ((config: TAppConnectionConfig) =>
- validateExternalInfisicalConnectionCredentials(
+ [AppConnection.ExternalInfisical]: ((config: TAppConnectionConfig) => {
+ if (!deps?.identityUaDAL) {
+ throw new InternalServerError({
+ message: "identityUaDAL is required to validate External Infisical connection credentials"
+ });
+ }
+ return validateExternalInfisicalConnectionCredentials(
config as TExternalInfisicalConnectionConfig,
- deps!.identityUaDAL!
- )) as TAppConnectionCredentialsValidator
+ deps.identityUaDAL
+ );
+ }) as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayService, gatewayV2Service);