Skip to content

Couple registry server URL and registry auth#4361

Merged
eleftherias merged 13 commits intomainfrom
couple-registry-auth
Mar 26, 2026
Merged

Couple registry server URL and registry auth#4361
eleftherias merged 13 commits intomainfrom
couple-registry-auth

Conversation

@eleftherias
Copy link
Copy Markdown
Member

@eleftherias eleftherias commented Mar 25, 2026

Issue #4360

Summary

When the registry URL changes, we should also reset the registry auth configuration.

Changes

  • Add registry auth flags to thv config set-registry
  • Override existing registry auth whenever thv config set-registry is called
  • Deprecate auth specific command thv config set-registry-auth and thv config unset-registry-auth
  • Override existing registry auth when API receives empty auth
  • Update docs to state authorization server needs to be OIDC-compliant, vanilla OAuth isn't supported at this time

@github-actions github-actions bot added the size/S Small PR: 100-299 lines changed label Mar 25, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 56.81818% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.55%. Comparing base (a9f92a0) to head (ef314e8).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
pkg/api/v1/registry.go 52.00% 11 Missing and 1 partial ⚠️
pkg/registry/auth/login.go 75.00% 2 Missing and 2 partials ⚠️
pkg/registry/auth_manager.go 0.00% 2 Missing ⚠️
pkg/registry/provider_api.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4361      +/-   ##
==========================================
- Coverage   69.55%   69.55%   -0.01%     
==========================================
  Files         480      480              
  Lines       48837    48925      +88     
==========================================
+ Hits        33971    34032      +61     
- Misses      12249    12267      +18     
- Partials     2617     2626       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/S Small PR: 100-299 lines changed labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification

[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Mar 25, 2026
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Mar 25, 2026
@github-actions github-actions bot dismissed their stale review March 25, 2026 12:33

Large PR justification has been provided. Thank you!

@github-actions
Copy link
Copy Markdown
Contributor

✅ Large PR justification has been provided. The size review has been dismissed and this PR can now proceed with normal review.

@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Mar 25, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/XL Extra large PR: 1000+ lines changed size/M Medium PR: 300-599 lines changed labels Mar 25, 2026
@eleftherias eleftherias marked this pull request as ready for review March 25, 2026 14:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR couples the configured registry source (URL/API/local) with its authentication configuration so that changing the registry also resets/overwrites auth, reducing the risk of sending stale tokens to the wrong registry.

Changes:

  • Extend thv config set-registry to accept OIDC auth flags and clear existing registry auth whenever the command runs; deprecate set-registry-auth / unset-registry-auth.
  • Update registry login/config behavior to apply auth overrides when flags are provided, and remove openid from default OAuth scopes.
  • Update the serve-mode Registry API to clear auth when auth is omitted, plus adjust user-facing error messages and CLI docs.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/registry/provider_api.go Updates 401 guidance to use thv config set-registry ... --issuer/--client-id.
pkg/registry/auth_manager.go Clarifies OIDC wording in AuthManager docs.
pkg/registry/auth/oauth_token_source.go Clarifies OIDC terminology in comments.
pkg/registry/auth/login.go Removes openid from defaults; changes registry/auth override semantics.
pkg/registry/auth/login_test.go Updates tests for new override + “clear auth on registry flag” behavior.
pkg/api/v1/registry.go Changes update semantics to overwrite/clear auth on PUT; updates auth-required messages.
cmd/thv/app/registry_login.go Updates login flag help text to reflect new semantics/default scopes.
cmd/thv/app/config.go Adds auth flags to config set-registry; clears auth on set/unset registry.
cmd/thv/app/config_registryauth.go Deprecates legacy registry-auth subcommands; updates help text/examples.
docs/cli/thv_registry_login.md Updates option descriptions and default scopes.
docs/cli/thv_config_set-registry.md Documents auth-clearing and new auth flags for set-registry.
docs/cli/thv_config.md Removes deprecated registry-auth commands from docs index.
docs/cli/thv_config_set-registry-auth.md Removes doc page for deprecated command.
docs/cli/thv_config_unset-registry-auth.md Removes doc page for deprecated command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

eleftherias and others added 2 commits March 25, 2026 16:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review from Claude Code.

Overall: The security concept is sound and well-motivated. A few questions and nits on the implementation details.

Summary:

  • 1 question on scope defaults (F7)
  • 1 ordering concern (F1)
  • 1 question on deprecated command removal (F2)
  • 1 nit on deprecation message (F5)
  • 1 nit on missing context propagation (F6)

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 25, 2026
@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 25, 2026
@github-actions github-actions bot added size/XL Extra large PR: 1000+ lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 25, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Large PR Detected

This PR exceeds 1000 lines of changes and requires justification before it can be reviewed.

How to unblock this PR:

Add a section to your PR description with the following format:

## Large PR Justification

[Explain why this PR must be large, such as:]
- Generated code that cannot be split
- Large refactoring that must be atomic
- Multiple related changes that would break if separated
- Migration or data transformation

Alternative:

Consider splitting this PR into smaller, focused changes (< 1000 lines each) for easier review and reduced risk.

See our Contributing Guidelines for more details.


This review will be automatically dismissed once you add the justification section.

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/XL Extra large PR: 1000+ lines changed labels Mar 25, 2026
@github-actions github-actions bot dismissed their stale review March 25, 2026 16:31

PR size has been reduced below the XL threshold. Thank you for splitting this up!

@github-actions
Copy link
Copy Markdown
Contributor

✅ PR size has been reduced below the XL threshold. The size review has been dismissed and this PR can now proceed with normal review. Thank you for splitting this up!

@github-actions github-actions bot added size/M Medium PR: 300-599 lines changed and removed size/M Medium PR: 300-599 lines changed labels Mar 25, 2026
@eleftherias eleftherias merged commit 9f7d1a8 into main Mar 26, 2026
42 of 43 checks passed
@eleftherias eleftherias deleted the couple-registry-auth branch March 26, 2026 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Medium PR: 300-599 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants