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
fix: resolved secret import secrets failing when folder has empty secrets
Akhil Mohan6773996d407a
diff --git a/backend/src/services/secret-import/secret-import-fns.ts b/backend/src/services/secret-import/secret-import-fns.tsindex 1fa55f214e..00b33a13c8 100644--- a/backend/src/services/secret-import/secret-import-fns.ts+++ b/backend/src/services/secret-import/secret-import-fns.ts@@ -41,13 +41,12 @@ export const fnSecretsFromImports = async ({environment: importEnv.slug,environmentInfo: importEnv,folderId: importedFolders?.[i]?.id,- secrets: importedFolders?.[i]?.id- ? importedSecsGroupByFolderId[importedFolders?.[i]?.id as string].map((item) => ({- ...item,- environment: importEnv.slug,- workspace: "", // This field should not be used, it's only here to keep the older Python SDK versions backwards compatible with the new Postgres backend.- _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.- }))- : []+ // this will ensure for cases when secrets are empty. Could be due to missing folder for a path or when emtpy secrets inside a given path+ secrets: (importedSecsGroupByFolderId?.[importedFolders?.[i]?.id as string] || []).map((item) => ({+ ...item,+ environment: importEnv.slug,+ workspace: "", // This field should not be used, it's only here to keep the older Python SDK versions backwards compatible with the new Postgres backend.+ _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.+ }))}));};