Skip to content

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

fix: resolved recursive secret logic pulling secret from top

=2f79ae42abdc
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.ts
index ab946a2afe..845b8d5698 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
@@ -334,7 +334,8 @@ export const recursivelyGetSecretPaths = async ({
folderDAL,
projectEnvDAL,
projectId,
- environment
+ environment,
+ currentPath
}: TRecursivelyFetchSecretsFromFoldersArg) => {
const env = await projectEnvDAL.findOne({
projectId,
@@ -362,7 +363,11 @@ export const recursivelyGetSecretPaths = async ({
folderId: p.folderId
}));
- return paths;
+ const pathsInCurrentDirectory = paths.filter((folder) =>
+ folder.path.startsWith(currentPath === "/" ? "" : currentPath)
+ );
+
+ return pathsInCurrentDirectory;
};
// used to convert multi line ones to quotes ones with \n
const formatMultiValueEnv = (val?: string) => {