Use scoped secrets provider for registry auth#4893
Merged
eleftherias merged 3 commits intomainfrom Apr 16, 2026
Merged
Conversation
After secret scope migration runs, registry tokens are moved from bare keys (REGISTRY_OAUTH_*) to the scoped namespace (__thv_registry_*). The factory and API login/logout handlers were still using the bare provider, so token lookups failed after migration and returned 401. Switch factory.go and the API registry auth handler to use CreateProvider with WithScope(ScopeRegistry). ScopedProvider.GetSecret falls back to bare keys during the migration window, and all new reads/writes go through the scoped namespace consistently. Also fix EncryptedManager.DeleteSecret to return ErrSecretNotFound (matching GetSecret) so callers relying on IsNotFoundError handle delete-not-found correctly. Fix #4892
rdimitrov
previously approved these changes
Apr 16, 2026
amirejaz
previously approved these changes
Apr 16, 2026
amirejaz
approved these changes
Apr 16, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4893 +/- ##
==========================================
+ Coverage 69.09% 69.21% +0.11%
==========================================
Files 531 531
Lines 55196 55159 -37
==========================================
+ Hits 38140 38179 +39
+ Misses 14131 14061 -70
+ Partials 2925 2919 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 loginstores tokens under the scoped key__thv_registry_REGISTRY_OAUTH_<hash>, butresolveTokenSourcein the factory andnewSecretsProviderin the API handler both used the bareCreateSecretProvider. The bare provider looks upREGISTRY_OAUTH_<hash>directly, finds nothing, and falls back to a new OAuth flow — prompting the browser again even though the user just logged in.CreateProvider(..., WithScope(ScopeRegistry))so token reads go to the scoped namespace, withScopedProvider.GetSecret's bare-key fallback covering the migration window.EncryptedManager.DeleteSecretto return theErrSecretNotFoundsentinel (matchingGetSecret) so callers usingIsNotFoundErrorhandle delete-not-found correctly.Fixes #4892
Type of change
Test plan
thv registry loginfollowed bythv registry listno longer re-opens the browser OAuth flow.Generated with Claude Code