Skip to content

Wire auto-auth self-healing channels into Vault Agent cache handler#32002

Open
VishalGawade1 wants to merge 2 commits into
hashicorp:mainfrom
VishalGawade1:agent-cache-autoauth-selfheal-31995
Open

Wire auto-auth self-healing channels into Vault Agent cache handler#32002
VishalGawade1 wants to merge 2 commits into
hashicorp:mainfrom
VishalGawade1:agent-cache-autoauth-selfheal-31995

Conversation

@VishalGawade1

Copy link
Copy Markdown

Description

Fixes #31995.

Vault Agent's auto-auth self-healing (introduced in #26307) is not wired up for the cache/proxy listener. In command/proxy.go, after the auth handler is created, the local authInProgress and invalidTokenErrCh variables are reassigned to the auth handler's AuthInProgress / InvalidToken channels before being passed to cache.ProxyHandler. The equivalent reassignment is missing in command/agent.go, so the cache handler ends up sending on an orphaned, unbuffered channel with no reader.

As a result, when vault agent is run with a cache listener and the auto-auth token is revoked, a request made with the revoked token hangs until timeout instead of triggering re-authentication (and each such request leaks a blocked goroutine). This affects both the leaseCache and api_proxy proxier paths, since both receive the same channels.

This PR adds the missing reassignment in command/agent.go, mirroring command/proxy.go, and adds a regression test (TestAgent_ReTriggerAutoAuth_RevokedToken) modeled on the existing TestProxy_ReTriggerAutoAuth_RevokedToken. With the fix the test passes; reverting the fix makes the revoked-token request hang, which the test's timeout guard catches.

@heatherezell — as discussed in the issue, here's the PR. Thanks!

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.
  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.
  • If applicable, I've documented the impact of any changes to security controls.

@VishalGawade1 VishalGawade1 requested a review from a team as a code owner June 18, 2026 20:29
@VishalGawade1 VishalGawade1 requested a review from kitography June 18, 2026 20:29
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 18, 2026
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vault-ui Error Error Jun 18, 2026 9:31pm

Request Review

@dosubot dosubot Bot added agent bug Used to indicate a potential bug labels Jun 18, 2026
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

The `vercel.json` schema validation failed with the following message: should NOT have additional property `public`

Learn More: https://vercel.com/docs/concepts/projects/project-configuration

@hashicorp-cla-app

hashicorp-cla-app Bot commented Jun 18, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent bug Used to indicate a potential bug size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vault Agent: auto-auth self-healing not wired for proxy/cache requests (missing channel assignment in command/agent.go)

1 participant