You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vault secret read makes two Vault API calls per secret (KV version preflight + secret read) #9514
Concourse currently performs a KV version preflight request for every secret read, followed by the actual secret read. This results in two Vault API calls per secret lookup.
In large Concourse deployments - especially those with many pipelines and resources using Vault as a credential manager - this behavior can significantly increase request volume and may lead to Vault rate limiting (requests-per-second limits being exceeded).
Code evidence:
In api_client.go:66, Read calls isKVv2 before reading the secret.
The preflight request is implemented in vault_kvhelpers.go:15 and sends GET to /v1/sys/internal/ui/mounts/.
After preflight, the actual secret read occurs in api_client.go:79.
Because the KV engine version is a static property of the mount, performing this preflight request on every read is redundant. At scale, this effectively doubles the number of Vault API calls, increasing latency and putting unnecessary pressure on Vault.
Steps to Reproduce
Start Concourse configured with Vault credential manager.
Ensure a pipeline/task references one or more Vault-backed vars.
Enable Vault audit logs. Or build Concourse version with logs.
Trigger a build that resolves secrets.
Observe that each secret resolution produces:
one preflight call to /v1/sys/internal/ui/mounts/
one data read call to the secret endpoint.
Expected Results
KV engine version should be determined once per mount and reused for subsequent reads under the same mount.
Actual Results
KV version is revalidated for each secret read, resulting in two calls per secret.
My initial thought was that we could do the do the lookup once since the root mount path is usually /something, but I then realized it is possible for someone to set CONCOURSE_VAULT_PATH_PREFIX to /, so someone could do vault lookups under all available mounts. Would be kind of crazy, but is technically possible.
I also just realized that secret engine mount paths can contain / in them. So a user could have a vault kv engine at /my/kv/engine1 and my/kv/engine2. Again, kinda wild, but technically possible.
Your plan sounds good, looking forward to your PR.
Activity
IvanChalukov commentedon Apr 8, 2026
I’d be happy to take this on.
I was thinking of following solution:
Expected impact:
taylorsilva commentedon Apr 9, 2026
I think your approach makes sense Ivan. I was looking at the code:
concourse/atc/creds/vault/api_client.go
Lines 64 to 69 in d013039
My initial thought was that we could do the do the lookup once since the root mount path is usually
/something, but I then realized it is possible for someone to setCONCOURSE_VAULT_PATH_PREFIXto/, so someone could do vault lookups under all available mounts. Would be kind of crazy, but is technically possible.I also just realized that secret engine mount paths can contain
/in them. So a user could have a vault kv engine at/my/kv/engine1andmy/kv/engine2. Again, kinda wild, but technically possible.Your plan sounds good, looking forward to your PR.