Skip to content

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

fix(secret-sync): use own-property checks in Daytona deletion loops

Calvin4b56dfe0049d
diff --git a/backend/src/services/secret-sync/daytona/daytona-sync-fns.ts b/backend/src/services/secret-sync/daytona/daytona-sync-fns.ts
index ba81d82133..424b93f5ca 100644
--- a/backend/src/services/secret-sync/daytona/daytona-sync-fns.ts
+++ b/backend/src/services/secret-sync/daytona/daytona-sync-fns.ts
@@ -113,7 +113,9 @@ export const DaytonaSyncFns = {
if (disableSecretDeletion) return;
for (const secret of existingSecrets) {
- if (secret.name in secretMap) {
+ // Own-property check, not `in`: `in` walks the prototype chain, so a Daytona secret named
+ // constructor or toString would match a folder that contains no such key.
+ if (Object.hasOwn(secretMap, secret.name)) {
// eslint-disable-next-line no-continue
continue;
}
@@ -143,7 +145,7 @@ export const DaytonaSyncFns = {
const existingSecrets = await listDaytonaSecrets(apiKey);
for (const secret of existingSecrets) {
- if (!(secret.name in secretMap)) {
+ if (!Object.hasOwn(secretMap, secret.name)) {
// eslint-disable-next-line no-continue
continue;
}