Skip to content

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

fix: requested changes

Daniel Hougaard88b30a89b2cc
diff --git a/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts b/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts
index 39920ba3ec..d636290f7f 100644
--- a/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts
+++ b/backend/src/services/secret-sync/hc-vault/hc-vault-sync-fns.ts
@@ -221,6 +221,24 @@ export const HCVaultSyncFns = {
}
}
+ // if no secrets remain after removal
+ if (Object.keys(variables).length === 0) {
+ // for kv v1: must DELETE the path entirely (empty secrets not allowed)
+ // for kv v2: can write empty data to keep the path with metadata
+ if (mountVersion === KvVersion.V1) {
+ const urlPath = `${removeTrailingSlash(mount)}/${path}`;
+ await requestWithHCVaultGateway(connection, gatewayService, gatewayV2Service, {
+ url: `${instanceUrl}/v1/${urlPath}`,
+ method: "DELETE",
+ headers: {
+ "X-Vault-Token": accessToken,
+ ...(namespace ? { "X-Vault-Namespace": namespace } : {})
+ }
+ });
+ return;
+ }
+ }
+
// Only update variables if there was a change detected
if (!tainted) return;
diff --git a/docs/integrations/app-connections/hashicorp-vault.mdx b/docs/integrations/app-connections/hashicorp-vault.mdx
index d1943b4c88..a14e0b1930 100644
--- a/docs/integrations/app-connections/hashicorp-vault.mdx
+++ b/docs/integrations/app-connections/hashicorp-vault.mdx
@@ -45,7 +45,7 @@ Infisical supports two methods for connecting to Hashicorp Vault.
<Tab title="Secret Sync">
```hcl
path "demo_mount/data/*" {
- capabilities = [ "create", "read", "update" ]
+ capabilities = [ "create", "read", "update", "delete" ]
}
path "sys/mounts" {