Clear all cached registry tokens on logout#5382
Merged
Merged
Conversation
thv registry logout only deleted the refresh-token key and its derived fallback. The shared OAuthTokenSource also persists an access-token cache under "<key>_AT", and its tier-2 lookup reads that key directly. The cached access token survived logout, so the next thv registry login short-circuited through the cache instead of triggering a fresh browser flow. Replace the targeted deletes with a list-and-bulk-delete over every secret visible to the registry-scoped provider, mirroring pkg/llm.DeleteCachedTokens. This also catches stale entries left behind under derived keys after a registry URL or issuer change. Closes #5373
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5382 +/- ##
=======================================
Coverage 68.81% 68.81%
=======================================
Files 627 627
Lines 63594 63600 +6
=======================================
+ Hits 43762 43767 +5
+ Misses 16583 16581 -2
- Partials 3249 3252 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ChrisJBurns
approved these changes
May 26, 2026
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.
Summary
thv registry logoutleft the cached access token stored under<key>_ATbehind, so the nextthv registry loginshort-circuited through tier 2 of the sharedOAuthTokenSourceand returned the cached token without ever triggering a browser flow. The same gap also left stale entries under derived keys after a registry URL or issuer change.pkg/registry/auth/login.go—Logoutnow lists every secret visible to the registry-scoped provider and deletes them in one shot, mirroringpkg/llm.DeleteCachedTokens. The refresh-token key, its_ATcompanion, and any stale entries from previous configs are all cleared in a single pass.pkg/registry/auth/login_test.go— replaces the targeted-delete tests with cases covering: full cleanup (including_ATand a stale entry), no-op on empty list, no-op for providers that can't list/delete, error propagation onListSecrets/DeleteSecrets, and config-update error propagation.Closes #5373
Type of change
Test plan
go test -race ./pkg/registry/auth/... ./pkg/auth/tokensource/... ./pkg/llm/...passestask lint-fixreports 0 issuesDoes this introduce a user-facing change?
thv registry logoutnow fully clears all cached registry OAuth credentials, so a subsequentthv registry loginalways triggers a fresh browser auth flow rather than silently reusing a cached access token.Generated with Claude Code