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
chore: fix lint
Daniel Hougaard296efa975c65
diff --git a/backend/src/db/migrations/20250210101840_webhook-to-kms.ts b/backend/src/db/migrations/20250210101840_webhook-to-kms.tsindex c9b8e7fec5..a2d8563889 100644--- a/backend/src/db/migrations/20250210101840_webhook-to-kms.ts+++ b/backend/src/db/migrations/20250210101840_webhook-to-kms.ts@@ -31,7 +31,7 @@ export async function up(knex: Knex): Promise<void> {const { kmsService } = await getMigrationEncryptionServices({ envConfig, keyStore, db: knex });const projectEncryptionRingBuffer =createCircularCache<Awaited<ReturnType<(typeof kmsService)["createCipherPairWithDataKey"]>>>(25);- const webhooks = await knex(TableName.Webhook)+ const webhooks = await knex(TableName.Webhook).where({}).join(TableName.Environment, `${TableName.Environment}.id`, `${TableName.Webhook}.envId`).select(@@ -53,10 +53,13 @@ export async function up(knex: Knex): Promise<void> {webhooks.map(async (el) => {let projectKmsService = projectEncryptionRingBuffer.getItem(el.projectId);if (!projectKmsService) {- projectKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.SecretManager,- projectId: el.projectId- }, knex);+ projectKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.SecretManager,+ projectId: el.projectId+ },+ knex+ );projectEncryptionRingBuffer.push(el.projectId, projectKmsService);}diff --git a/backend/src/db/migrations/20250210101841_dynamic-secret-root-to-kms.ts b/backend/src/db/migrations/20250210101841_dynamic-secret-root-to-kms.tsindex 41dc6ba9f1..dde1e71889 100644--- a/backend/src/db/migrations/20250210101841_dynamic-secret-root-to-kms.ts+++ b/backend/src/db/migrations/20250210101841_dynamic-secret-root-to-kms.ts@@ -46,10 +46,13 @@ export async function up(knex: Knex): Promise<void> {dynamicSecretRootCredentials.map(async ({ projectId, ...el }) => {let projectKmsService = projectEncryptionRingBuffer.getItem(projectId);if (!projectKmsService) {- projectKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.SecretManager,- projectId- }, knex);+ projectKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.SecretManager,+ projectId+ },+ knex+ );projectEncryptionRingBuffer.push(projectId, projectKmsService);}diff --git a/backend/src/db/migrations/20250210101841_secret-rotation-to-kms.ts b/backend/src/db/migrations/20250210101841_secret-rotation-to-kms.tsindex 567cace991..e11ef926e9 100644--- a/backend/src/db/migrations/20250210101841_secret-rotation-to-kms.ts+++ b/backend/src/db/migrations/20250210101841_secret-rotation-to-kms.ts@@ -39,10 +39,13 @@ export async function up(knex: Knex): Promise<void> {secretRotations.map(async ({ projectId, ...el }) => {let projectKmsService = projectEncryptionRingBuffer.getItem(projectId);if (!projectKmsService) {- projectKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.SecretManager,- projectId- }, knex);+ projectKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.SecretManager,+ projectId+ },+ knex+ );projectEncryptionRingBuffer.push(projectId, projectKmsService);}diff --git a/backend/src/db/migrations/20250210101842_identity-k8-auth-to-kms.ts b/backend/src/db/migrations/20250210101842_identity-k8-auth-to-kms.tsindex 3d62ab04fb..934dce5e83 100644--- a/backend/src/db/migrations/20250210101842_identity-k8-auth-to-kms.ts+++ b/backend/src/db/migrations/20250210101842_identity-k8-auth-to-kms.ts@@ -76,77 +76,87 @@ const reencryptIdentityK8sAuth = async (knex: Knex) => {).orderBy(`${TableName.OrgBot}.orgId` as "orgId");- const updatedIdentityKubernetesConfigs = [];+ const updatedIdentityKubernetesConfigs = [];- for (const { encryptedSymmetricKey, symmetricKeyKeyEncoding, symmetricKeyTag, symmetricKeyIV, orgId, ...el } of identityKubernetesConfigs) {- let orgKmsService = orgEncryptionRingBuffer.getItem(orgId);-- if (!orgKmsService) {- orgKmsService = await kmsService.createCipherPairWithDataKey({+ for await (const {+ encryptedSymmetricKey,+ symmetricKeyKeyEncoding,+ symmetricKeyTag,+ symmetricKeyIV,+ orgId,+ ...el+ } of identityKubernetesConfigs) {+ let orgKmsService = orgEncryptionRingBuffer.getItem(orgId);++ if (!orgKmsService) {+ orgKmsService = await kmsService.createCipherPairWithDataKey(+ {type: KmsDataKey.Organization,orgId- }, knex);- orgEncryptionRingBuffer.push(orgId, orgKmsService);- }-- const key = infisicalSymmetricDecrypt({- ciphertext: encryptedSymmetricKey,- iv: symmetricKeyIV,- tag: symmetricKeyTag,- keyEncoding: symmetricKeyKeyEncoding as SecretKeyEncoding- });-- const decryptedTokenReviewerJwt =- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- el.encryptedTokenReviewerJwt && el.tokenReviewerJwtIV && el.tokenReviewerJwtTag- ? decryptSymmetric({- key,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- iv: el.tokenReviewerJwtIV,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- tag: el.tokenReviewerJwtTag,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- ciphertext: el.encryptedTokenReviewerJwt- })- : "";-- const decryptedCertificate =- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- el.encryptedCaCert && el.caCertIV && el.caCertTag- ? decryptSymmetric({- key,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- iv: el.caCertIV,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- tag: el.caCertTag,- // eslint-disable-next-line @typescript-eslint/ban-ts-comment- // @ts-ignore This will be removed in next cycle so ignore the ts missing error- ciphertext: el.encryptedCaCert- })- : "";-- const encryptedKubernetesTokenReviewerJwt = orgKmsService.encryptor({- plainText: Buffer.from(decryptedTokenReviewerJwt)- }).cipherTextBlob;- const encryptedKubernetesCaCertificate = orgKmsService.encryptor({- plainText: Buffer.from(decryptedCertificate)- }).cipherTextBlob;-- updatedIdentityKubernetesConfigs.push({- ...el,- accessTokenTrustedIps: JSON.stringify(el.accessTokenTrustedIps),- encryptedKubernetesCaCertificate,- encryptedKubernetesTokenReviewerJwt- });+ },+ knex+ );+ orgEncryptionRingBuffer.push(orgId, orgKmsService);}+ const key = infisicalSymmetricDecrypt({+ ciphertext: encryptedSymmetricKey,+ iv: symmetricKeyIV,+ tag: symmetricKeyTag,+ keyEncoding: symmetricKeyKeyEncoding as SecretKeyEncoding+ });++ const decryptedTokenReviewerJwt =+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ el.encryptedTokenReviewerJwt && el.tokenReviewerJwtIV && el.tokenReviewerJwtTag+ ? decryptSymmetric({+ key,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ iv: el.tokenReviewerJwtIV,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ tag: el.tokenReviewerJwtTag,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ ciphertext: el.encryptedTokenReviewerJwt+ })+ : "";++ const decryptedCertificate =+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ el.encryptedCaCert && el.caCertIV && el.caCertTag+ ? decryptSymmetric({+ key,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ iv: el.caCertIV,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ tag: el.caCertTag,+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment+ // @ts-ignore This will be removed in next cycle so ignore the ts missing error+ ciphertext: el.encryptedCaCert+ })+ : "";++ const encryptedKubernetesTokenReviewerJwt = orgKmsService.encryptor({+ plainText: Buffer.from(decryptedTokenReviewerJwt)+ }).cipherTextBlob;+ const encryptedKubernetesCaCertificate = orgKmsService.encryptor({+ plainText: Buffer.from(decryptedCertificate)+ }).cipherTextBlob;++ updatedIdentityKubernetesConfigs.push({+ ...el,+ accessTokenTrustedIps: JSON.stringify(el.accessTokenTrustedIps),+ encryptedKubernetesCaCertificate,+ encryptedKubernetesTokenReviewerJwt+ });+ }+for (let i = 0; i < updatedIdentityKubernetesConfigs.length; i += BATCH_SIZE) {// eslint-disable-next-line no-await-in-loopawait knex(TableName.IdentityKubernetesAuth)diff --git a/backend/src/db/migrations/20250210101842_identity-oidc-auth-to-kms.ts b/backend/src/db/migrations/20250210101842_identity-oidc-auth-to-kms.tsindex dc87726a47..011585bdaa 100644--- a/backend/src/db/migrations/20250210101842_identity-oidc-auth-to-kms.ts+++ b/backend/src/db/migrations/20250210101842_identity-oidc-auth-to-kms.ts@@ -62,10 +62,13 @@ const reencryptIdentityOidcAuth = async (knex: Knex) => {async ({ encryptedSymmetricKey, symmetricKeyKeyEncoding, symmetricKeyTag, symmetricKeyIV, orgId, ...el }) => {let orgKmsService = orgEncryptionRingBuffer.getItem(orgId);if (!orgKmsService) {- orgKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.Organization,- orgId- }, knex);+ orgKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.Organization,+ orgId+ },+ knex+ );orgEncryptionRingBuffer.push(orgId, orgKmsService);}const key = infisicalSymmetricDecrypt({diff --git a/backend/src/db/migrations/20250210101845_directory-config-to-kms.ts b/backend/src/db/migrations/20250210101845_directory-config-to-kms.tsindex 05db409584..f5107b3017 100644--- a/backend/src/db/migrations/20250210101845_directory-config-to-kms.ts+++ b/backend/src/db/migrations/20250210101845_directory-config-to-kms.ts@@ -49,10 +49,13 @@ const reencryptSamlConfig = async (knex: Knex) => {async ({ encryptedSymmetricKey, symmetricKeyKeyEncoding, symmetricKeyTag, symmetricKeyIV, ...el }) => {let orgKmsService = orgEncryptionRingBuffer.getItem(el.orgId);if (!orgKmsService) {- orgKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.Organization,- orgId: el.orgId- }, knex);+ orgKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.Organization,+ orgId: el.orgId+ },+ knex+ );orgEncryptionRingBuffer.push(el.orgId, orgKmsService);}const key = infisicalSymmetricDecrypt({@@ -204,10 +207,13 @@ const reencryptLdapConfig = async (knex: Knex) => {async ({ encryptedSymmetricKey, symmetricKeyKeyEncoding, symmetricKeyTag, symmetricKeyIV, ...el }) => {let orgKmsService = orgEncryptionRingBuffer.getItem(el.orgId);if (!orgKmsService) {- orgKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.Organization,- orgId: el.orgId- }, knex);+ orgKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.Organization,+ orgId: el.orgId+ },+ knex+ );orgEncryptionRingBuffer.push(el.orgId, orgKmsService);}const key = infisicalSymmetricDecrypt({@@ -353,10 +359,13 @@ const reencryptOidcConfig = async (knex: Knex) => {async ({ encryptedSymmetricKey, symmetricKeyKeyEncoding, symmetricKeyTag, symmetricKeyIV, ...el }) => {let orgKmsService = orgEncryptionRingBuffer.getItem(el.orgId);if (!orgKmsService) {- orgKmsService = await kmsService.createCipherPairWithDataKey({- type: KmsDataKey.Organization,- orgId: el.orgId- }, knex);+ orgKmsService = await kmsService.createCipherPairWithDataKey(+ {+ type: KmsDataKey.Organization,+ orgId: el.orgId+ },+ knex+ );orgEncryptionRingBuffer.push(el.orgId, orgKmsService);}const key = infisicalSymmetricDecrypt({