spring-cloud / spring-cloud/spring-cloud-vault
HTTP 502 which happens during Vault login in "KUBERNETES" auth mode is cached indefinitely
Open
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 291
- Forks
- 152
- Avg merge
- 11h 24m
- Merged PRs (30d)
- 3
Description
Describe the bug
- Spring boot 4.0.5 + Spring cloud vault 5.0.0 (+spring-vault-core 4.0.0) deployed k8s infra
- Service uses "KUBERNETES" vault authentication mode
- Service uses Vault transit to generate JWT signatures (but this is irrelevant actually)
- Service caches Vault token
- Vault goes down and all requests to it ends up with 502/504
- Vault token in Spring service expires
- Spring cloud vault tries to renew the token using logic org.springframework.vault.authentication.ReactiveLifecycleAwareSessionManager#scheduleRenewal
- As Vault is unavailable org.springframework.vault.authentication.ReactiveLifecycleAwareSessionManager#doRenewToken catches the exception and cleans the mono cache: org.springframework.vault.authentication.ReactiveLifecycleAwareSessionManager#token
- Following getVaultToken() calls (scheduled, or triggered by user interactions) infect Mono cache with a Mono which returns 502/504 and is cached indefinitely: org/springframework/vault/authentication/ReactiveLifecycleAwareSessionManager.java:330
Sample
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with org/springframework/vault/authentication/ReactiveLifecycleAwareSessionManager.java, especially the token cache around line 330 and the renewal flow in scheduleRenewal and doRenewToken. Use the linked VaultSessionCachingBugIntegrationTest.java as the reproduction; done means a transient 502/504 during Vault recovery is not cached indefinitely and token acquisition works after Vault returns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, kubernetes, spring
- Domain
- authentication, backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100