Skip to content

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

Add skipHsmLicenseCheck on getMigrationEncryptionServices

Carlos Monastyrski1587d03072d1
diff --git a/backend/src/db/migrations/20260612142201_pam-revamp.ts b/backend/src/db/migrations/20260612142201_pam-revamp.ts
index 2f9de78e4c..26fbe5b3c0 100644
--- a/backend/src/db/migrations/20260612142201_pam-revamp.ts
+++ b/backend/src/db/migrations/20260612142201_pam-revamp.ts
@@ -275,7 +275,12 @@ export async function up(knex: Knex): Promise<void> {
const kmsRootConfigDAL = kmsRootConfigDALFactory(knex);
const envConfig = await getMigrationEnvConfig(superAdminDAL, hsmService, kmsRootConfigDAL);
const keyStore = inMemoryKeyStore();
- const { kmsService } = await getMigrationEncryptionServices({ envConfig, keyStore, db: knex });
+ const { kmsService } = await getMigrationEncryptionServices({
+ envConfig,
+ keyStore,
+ db: knex,
+ skipHsmLicenseCheck: true
+ });
const getProjectCipher = async (projectId: string) =>
kmsService.createCipherPairWithDataKey({ type: KmsDataKey.SecretManager, projectId }, knex);
diff --git a/backend/src/db/migrations/utils/services.ts b/backend/src/db/migrations/utils/services.ts
index 577e8cc674..554e849337 100644
--- a/backend/src/db/migrations/utils/services.ts
+++ b/backend/src/db/migrations/utils/services.ts
@@ -29,6 +29,7 @@ type TDependencies = {
envConfig: TMigrationEnvConfig;
db: Knex;
keyStore: TKeyStoreFactory;
+ skipHsmLicenseCheck?: boolean;
};
type THsmServiceDependencies = {
@@ -49,7 +50,12 @@ export const getMigrationHsmService = async ({ envConfig }: THsmServiceDependenc
return { hsmService };
};
-export const getMigrationEncryptionServices = async ({ envConfig, db, keyStore }: TDependencies) => {
+export const getMigrationEncryptionServices = async ({
+ envConfig,
+ db,
+ keyStore,
+ skipHsmLicenseCheck = false
+}: TDependencies) => {
// ----- DAL dependencies -----
const orgDAL = orgDALFactory(db);
const licenseDAL = licenseDALFactory(db);
@@ -88,8 +94,6 @@ export const getMigrationEncryptionServices = async ({ envConfig, db, keyStore }
envConfig
});
- await licenseService.init();
-
// ----- HSM startup -----
const { hsmService } = await getMigrationHsmService({ envConfig });
@@ -97,7 +101,7 @@ export const getMigrationEncryptionServices = async ({ envConfig, db, keyStore }
const hsmStatus = await isHsmActiveAndEnabled({
hsmService,
kmsRootConfigDAL,
- licenseService
+ licenseService: skipHsmLicenseCheck ? undefined : licenseService
});
// if the encryption strategy is software - user needs to provide an encryption key