updateConfigTokenRef uses global config instead of injected provider
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 300
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 184
Description
Summary
pkg/registry/auth/oauth_token_source.go:updateConfigTokenRef calls the package-level config.UpdateConfig(...) function rather than going through an injected config.Provider interface.
This means the token reference/expiry is always written to the default config file location, even when a non-default config path is in use (e.g., via PathProvider in tests or custom deployments).
Impact
- In tests using custom config paths, the token reference may be written to the wrong file
- Inconsistent with the rest of the auth flow which properly uses injected
config.Provider
Suggested Fix
Pass a config.Provider into the oauthTokenSource constructor (or pass an updateFn func(func(*config.Config)) error callback), and use it in updateConfigTokenRef instead of the global function.
Context
Found during review of #4121 (registry login/logout CLI commands).
🤖 Generated with Claude Code
Contributor guide
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 in pkg/registry/auth/oauth_token_source.go at updateConfigTokenRef and trace the oauthTokenSource constructor and existing config.Provider usage in the auth flow. Reproduce the behavior with a non-default config path such as the PathProvider setup mentioned in the issue. Done means the token reference and expiry are written through the injected provider, with coverage for the custom path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- authentication, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100