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
feat: resolved getSecretByName empty value from imported in kms arch
=4feff5b4ca6d
diff --git a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.tsindex 4ae4d25ead..81ccf35f68 100644--- a/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts+++ b/backend/src/ee/services/secret-approval-request/secret-approval-request-service.ts@@ -224,12 +224,10 @@ export const secretApprovalRequestServiceFactory = ({secretKey: el.key,id: el.id,version: el.version,- secretValue: el.encryptedValue- ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString()- : undefined,+ secretValue: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : "",secretComment: el.encryptedComment? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString()- : undefined,+ : "",secret: el.secret? {secretKey: el.secret.key,@@ -237,10 +235,10 @@ export const secretApprovalRequestServiceFactory = ({version: el.secret.version,secretValue: el.secret.encryptedValue? secretManagerDecryptor({ cipherTextBlob: el.secret.encryptedValue }).toString()- : undefined,+ : "",secretComment: el.secret.encryptedComment? secretManagerDecryptor({ cipherTextBlob: el.secret.encryptedComment }).toString()- : undefined+ : ""}: undefined,secretVersion: el.secretVersion@@ -250,10 +248,10 @@ export const secretApprovalRequestServiceFactory = ({version: el.secretVersion.version,secretValue: el.secretVersion.encryptedValue? secretManagerDecryptor({ cipherTextBlob: el.secretVersion.encryptedValue }).toString()- : undefined,+ : "",secretComment: el.secretVersion.encryptedComment? secretManagerDecryptor({ cipherTextBlob: el.secretVersion.encryptedComment }).toString()- : undefined+ : ""}: undefined}));diff --git a/backend/src/ee/services/secret-replication/secret-replication-service.ts b/backend/src/ee/services/secret-replication/secret-replication-service.tsindex b32d459c52..b77d6cbc2c 100644--- a/backend/src/ee/services/secret-replication/secret-replication-service.ts+++ b/backend/src/ee/services/secret-replication/secret-replication-service.ts@@ -257,7 +257,7 @@ export const secretReplicationServiceFactory = ({secretDAL: secretV2BridgeDAL,folderDAL,secretImportDAL,- decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : undefined)+ decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : "")});// secrets that gets replicated across importsconst sourceDecryptedLocalSecrets = sourceLocalSecrets.map((el) => ({diff --git a/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts b/backend/src/ee/services/secret-snapshot/secret-snapshot-service.tsindex c5d8bd4fa8..2253391047 100644--- a/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts+++ b/backend/src/ee/services/secret-snapshot/secret-snapshot-service.ts@@ -164,10 +164,10 @@ export const secretSnapshotServiceFactory = ({secretKey: el.key,secretValue: el.encryptedValue? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString()- : undefined,+ : "",secretComment: el.encryptedComment? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString()- : undefined+ : ""}))};} else {diff --git a/backend/src/server/routes/sanitizedSchemas.ts b/backend/src/server/routes/sanitizedSchemas.tsindex a10a962cf3..02d9e37e0c 100644--- a/backend/src/server/routes/sanitizedSchemas.ts+++ b/backend/src/server/routes/sanitizedSchemas.ts@@ -63,8 +63,8 @@ export const secretRawSchema = z.object({version: z.number(),type: z.string(),secretKey: z.string(),- secretValue: z.string().optional(),- secretComment: z.string().optional(),+ secretValue: z.string(),+ secretComment: z.string(),secretReminderNote: z.string().nullable().optional(),secretReminderRepeatDays: z.number().nullable().optional(),skipMultilineEncoding: z.boolean().default(false).nullable().optional(),diff --git a/backend/src/services/secret-import/secret-import-fns.ts b/backend/src/services/secret-import/secret-import-fns.tsindex 1ccaaefc2c..f7c31ac618 100644--- a/backend/src/services/secret-import/secret-import-fns.ts+++ b/backend/src/services/secret-import/secret-import-fns.ts@@ -36,8 +36,8 @@ type TSecretImportSecretsV2 = {secretKey: string;// akhilmhdh: yes i know you can put ?.// But for somereason ts consider ? and undefined explicit as different just ts things- secretValue: string | undefined;- secretComment: string | undefined;+ secretValue: string;+ secretComment: string;})[];};@@ -157,7 +157,7 @@ export const fnSecretsV2FromImports = async ({secretImportDAL: Pick<TSecretImportDALFactory, "findByFolderIds">;depth?: number;cyclicDetector?: Set<string>;- decryptor: (value?: Buffer | null) => string | undefined;+ decryptor: (value?: Buffer | null) => string;expandSecretReferences?: (secrets: Record<string, { value?: string; comment?: string; skipMultilineEncoding?: boolean | null }>) => Promise<Record<string, { value?: string; comment?: string; skipMultilineEncoding?: boolean | null }>>;@@ -231,6 +231,7 @@ export const fnSecretsV2FromImports = async ({_id: item.id // The old Python SDK depends on the _id field being returned. We return this to keep the older Python SDK versions backwards compatible with the new Postgres backend.})).concat(folderDeeperImportSecrets);+return {secretPath: importPath,environment: importEnv.slug,@@ -254,7 +255,7 @@ export const fnSecretsV2FromImports = async ({};return acc;},- {} as Record<string, { value?: string; comment?: string; skipMultilineEncoding?: boolean | null }>+ {} as Record<string, { value: string; comment?: string; skipMultilineEncoding?: boolean | null }>);// eslint-disable-next-lineawait expandSecretReferences(secretsGroupByKey);diff --git a/backend/src/services/secret-import/secret-import-service.ts b/backend/src/services/secret-import/secret-import-service.tsindex c69fec6b60..c3d1a6791e 100644--- a/backend/src/services/secret-import/secret-import-service.ts+++ b/backend/src/services/secret-import/secret-import-service.ts@@ -507,7 +507,7 @@ export const secretImportServiceFactory = ({folderDAL,secretDAL: secretV2BridgeDAL,secretImportDAL,- decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : undefined)+ decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : "")});return importedSecrets;}diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.tsindex 8bd5c55f3c..e58960a4ba 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-fns.ts@@ -528,8 +528,8 @@ export const reshapeBridgeSecret = (environment: string,secretPath: string,secret: Omit<TSecretsV2, "encryptedValue" | "encryptedComment"> & {- value?: string;- comment?: string;+ value: string;+ comment: string;tags?: {id: string;slug: string;diff --git a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.tsindex ba3c8539d2..b594f98ca8 100644--- a/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts+++ b/backend/src/services/secret-v2-bridge/secret-v2-bridge-service.ts@@ -196,7 +196,7 @@ export const secretV2BridgeServiceFactory = ({return reshapeBridgeSecret(projectId, environment, secretPath, {...secret[0],value: inputSecret.secretValue,- comment: inputSecret.secretComment+ comment: inputSecret.secretComment || ""});};@@ -339,8 +339,8 @@ export const secretV2BridgeServiceFactory = ({});return reshapeBridgeSecret(projectId, environment, secretPath, {...updatedSecret[0],- value: inputSecret.secretValue,- comment: inputSecret.secretComment+ value: inputSecret.secretValue || "",+ comment: inputSecret.secretComment || ""});};@@ -424,10 +424,10 @@ export const secretV2BridgeServiceFactory = ({...deletedSecret[0],value: deletedSecret[0].encryptedValue? secretManagerDecryptor({ cipherTextBlob: deletedSecret[0].encryptedValue }).toString()- : undefined,+ : "",comment: deletedSecret[0].encryptedComment? secretManagerDecryptor({ cipherTextBlob: deletedSecret[0].encryptedComment }).toString()- : undefined+ : ""});};@@ -570,7 +570,7 @@ export const secretV2BridgeServiceFactory = ({folderDAL,secretImportDAL,expandSecretReferences,- decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : undefined)+ decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : "")});return {@@ -670,7 +670,7 @@ export const secretV2BridgeServiceFactory = ({secretDAL,folderDAL,secretImportDAL,- decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : undefined),+ decryptor: (value) => (value ? secretManagerDecryptor({ cipherTextBlob: value }).toString() : ""),expandSecretReferences: shouldExpandSecretReferences ? expandSecretReferences : undefined});@@ -678,12 +678,11 @@ export const secretV2BridgeServiceFactory = ({for (let j = 0; j < importedSecrets[i].secrets.length; j += 1) {const importedSecret = importedSecrets[i].secrets[j];if (secretName === importedSecret.key) {- return reshapeBridgeSecret(- projectId,- importedSecrets[i].environment,- importedSecrets[i].secretPath,- importedSecret- );+ return reshapeBridgeSecret(projectId, importedSecrets[i].environment, importedSecrets[i].secretPath, {+ ...importedSecret,+ value: importedSecret.secretValue || "",+ comment: importedSecret.secretComment || ""+ });}}}@@ -692,7 +691,7 @@ export const secretV2BridgeServiceFactory = ({let secretValue = secret.encryptedValue? secretManagerDecryptor({ cipherTextBlob: secret.encryptedValue }).toString()- : undefined;+ : "";if (shouldExpandSecretReferences && secretValue) {const secretReferenceExpandedRecord = {[secret.key]: { value: secretValue }@@ -707,7 +706,7 @@ export const secretV2BridgeServiceFactory = ({value: secretValue,comment: secret.encryptedComment? secretManagerDecryptor({ cipherTextBlob: secret.encryptedComment }).toString()- : undefined+ : ""});};@@ -797,10 +796,8 @@ export const secretV2BridgeServiceFactory = ({return newSecrets.map((el) =>reshapeBridgeSecret(projectId, environment, secretPath, {...el,- value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : undefined,- comment: el.encryptedComment- ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString()- : undefined+ value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : "",+ comment: el.encryptedComment ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString() : ""}));};@@ -918,10 +915,8 @@ export const secretV2BridgeServiceFactory = ({return secrets.map((el) =>reshapeBridgeSecret(projectId, environment, secretPath, {...el,- value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : undefined,- comment: el.encryptedComment- ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString()- : undefined+ value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : "",+ comment: el.encryptedComment ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString() : ""}));};@@ -997,10 +992,8 @@ export const secretV2BridgeServiceFactory = ({return secretsDeleted.map((el) =>reshapeBridgeSecret(projectId, environment, secretPath, {...el,- value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : undefined,- comment: el.encryptedComment- ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString()- : undefined+ value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : "",+ comment: el.encryptedComment ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString() : ""}));};@@ -1036,10 +1029,8 @@ export const secretV2BridgeServiceFactory = ({return secretVersions.map((el) =>reshapeBridgeSecret(folder.projectId, folder.environment.envSlug, "/", {...el,- value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : undefined,- comment: el.encryptedComment- ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString()- : undefined+ value: el.encryptedValue ? secretManagerDecryptor({ cipherTextBlob: el.encryptedValue }).toString() : "",+ comment: el.encryptedComment ? secretManagerDecryptor({ cipherTextBlob: el.encryptedComment }).toString() : ""}));};diff --git a/backend/src/services/secret/secret-service.ts b/backend/src/services/secret/secret-service.tsindex 57f3015947..c62a73f69e 100644--- a/backend/src/services/secret/secret-service.ts+++ b/backend/src/services/secret/secret-service.ts@@ -1154,6 +1154,7 @@ export const secretServiceFactory = ({type,secretName});+return secret;}