feat(config): Revoke Vault token on shutdown#1088
Merged
gtema merged 1 commit intoJul 24, 2026
Merged
Conversation
Complete the Vault token lease lifecycle. The runtime already leases and renews its token, but never revoked it: on shutdown the token lingered valid until its TTL expired. Add VaultRuntime::revoke (auth/token/revoke-self) and drive it from graceful shutdown. ConfigManager now owns a CancellationToken and the watcher JoinHandle; ConfigManager::shutdown cancels the watch loop and awaits it, and the loop revokes the token before exiting. Keystone's terminate hook calls it, so revocation completes before the process exits. Revoking invalidates the token (and any leases created with it) immediately instead of leaving valid credentials outstanding. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Yousef Hussein <ymh1874@gmail.com>
magdang
marked this pull request as ready for review
July 24, 2026 15:15
gtema
approved these changes
Jul 24, 2026
Merged
via the queue into
openstack-experimental:main
with commit Jul 24, 2026
c7ce2cb
33 checks passed
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Follow-up to #1051 (now merged). Addresses the maintainer's note that the Vault integration is missing something — pointing at HashiCorp's lease, renew, revoke doc.
That doc describes a three-part token lifecycle: lease → renew → revoke. #1051 already leases the auth token (
resolve→lookup-self, capturing TTL/renewable) and renews it (renew_if_dueat half-TTL). The missing third part is revoke: on shutdown the token was simply left to expire on its own TTL, leaving valid credentials outstanding after the process is gone.What
VaultRuntime::revoke— callsauth/token/revoke-selfviavaultrsClient::revoke(); newVaultConfigError::TokenRevocation.ConfigManagernow owns aCancellationTokenand the watcherJoinHandle. NewConfigManager::shutdown()cancels the watch loop and awaits it; the loop revokes the Vault token before exiting (covers both the shutdown-cancel and watcher-channel-close exit paths).terminate()(core/src/keystone.rs) — the existing graceful-shutdown hook, awaited beforetoken.cancel()— now callsconfig_manager.shutdown(), so revocation completes before the process exits (race-free, no reliance on the fire-and-forget task surviving).CancellationToken+tokio::select!teardown pattern.Scope notes (deliberately excluded)
vault lease revoke -prefix) is an operator/CLI action, not something a config loader performs.Tests
test_vault_token_revoked_on_shutdown— mocksrevoke-self, drivesConfigManager::shutdown(), asserts exactly one revoke call.test_shutdown_without_vault_is_noop— non-Vault config:shutdown()returns promptly and doesn't panic.🤖 Generated with Claude Code