Honor --allow-private-ip on thv registry login --registry#5353
Merged
Conversation
…ogin `thv config set-registry --allow-private-ip <url>` lets an operator point the CLI at a registry behind a private/corp IP. The same option was missing from `thv registry login`, and even via the Go API the boolean was hardcoded to false one layer down — so an operator using `thv registry login --registry http://10.x.y.z/...` to register and authenticate in one step always hit the private-IP rejection regardless of intent. - LoginOptions: add AllowPrivateIP. - ensureRegistryURL: thread it into DetectRegistryType and the SetRegistryAPI / SetRegistryURL calls (which were `false` literals). - registry_login.go: add -p/--allow-private-ip mirroring the flag on set-registry. No behavior change for callers that leave the new field at its zero value. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5353 +/- ##
==========================================
+ Coverage 68.38% 68.43% +0.05%
==========================================
Files 624 624
Lines 63442 63442
==========================================
+ Hits 43386 43419 +33
+ Misses 16818 16784 -34
- Partials 3238 3239 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ChrisJBurns
approved these changes
May 20, 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 config set-registry --allow-private-ip <url>lets an operator point the CLI at a registry behind a private/corp IP. The matching option is missing fromthv registry login, and even via the Go API the boolean was hardcoded one layer down — so an operator combining registration + login in a single step (thv registry login --registry http://10.x.y.z/api --issuer ... --client-id ...) always hits the private-IP rejection regardless of intent.The same gap applies to
auth.Loginwhen used programmatically:LoginOptionshad no way to express "this registry is allowed on a private IP."This PR closes the gap symmetrically:
pkg/registry/auth/login.go— addsAllowPrivateIP booltoLoginOptions.ensureRegistryURLthreads it intoconfig.DetectRegistryType(so the API-vs-static probe can actually reach the registry) and into theSetRegistryAPI/SetRegistryURLcalls (which werefalseliterals).cmd/thv/app/registry_login.go— adds-p/--allow-private-ip, mirroring the flag onthv config set-registry. Default isfalse.docs/cli/thv_registry_login.md— regenerated viatask docs.pkg/registry/auth/login_test.go— new table case inTestEnsureRegistryURLprovingAllowPrivateIP: truepropagates toSetRegistryURL. The existingfalse-cases stay untouched, so the no-flag path is regression-guarded.No behavior change for callers that leave the new field at its zero value.
Fixes #5351
Type of change
Test plan
task test)task lint-fix)task docs)go build ./cmd/thv+thv registry login --helpshows the new-p, --allow-private-ipflag.🤖 Generated with Claude Code