Repository navigation
fix(registry): reject invalid custom registry credentials - #136
Conversation
Treat only HTTP 2xx as success for custom registry connection checks. When username/password are configured, 401 and 403 are authentication failures with actionable errors that name the registry without leaking credentials. Preserve unauthenticated 401 as reachability success. Fixes #131 Signed-off-by: MrBeldum <mrbeldum@users.noreply.github.com>
|
Warning Review limit reachedNext included review available in 45 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe custom registry connection check validates credential pairs, requires HTTPS for authenticated requests, sends Basic authentication when configured, and reports sanitized registry errors. Tests cover authentication headers, response handling, validation failures, and URL redaction. ChangesCustom registry validation
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: 🟠 High · up to A registry redirect can expose configured credentials over cleartext, so redirect handling should be constrained before merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update the former custom 401-success test to expect authentication failure when credentials are set. Add no-credential, incomplete credential, 403, and empty-URL cases from issue #131. Signed-off-by: MrBeldum <mrbeldum@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Team
Run ID: cbf0ccb0-fe0c-401c-9a41-e79e6344f8cf
📒 Files selected for processing (2)
services/registry_service.goservices/registry_service_test.go
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
|
Hey @MrBeldum |
31a7c5d to
bb4bd72
Compare
Address CodeRabbit review on PR #136: reject incomplete Basic credentials, require HTTPS before sending Authorization, redact URL labels in errors, and assert the exact Base64 Basic auth payload in tests. Signed-off-by: MrBeldum <mrbeldum@users.noreply.github.com>
bb4bd72 to
02f3d96
Compare
|
@mohit-nagaraj Thanks for the ping — addressed all CodeRabbit review comments in
Ready for re-review. |
|
@mohit-nagaraj Addressed the CodeRabbit review comments in bb4bd72:
DCO is green on the tip commit. Ready for another look when you have a chance. |
|
Addressed the CodeRabbit review feedback in 31a7c5d:
Ready for re-review. |
There was a problem hiding this comment.
Actionable comments posted: 4
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: eaa313ab-a4d6-4996-b803-e65942738a83
📒 Files selected for processing (2)
services/registry_service.goservices/registry_service_test.go
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
Address remaining CodeRabbit review on PR #136: - Parse registry URL first and reject embedded userinfo - Do not wrap parse/transport errors that may contain URLs - Return a fixed label for non-absolute URLs - Assert HTTP is attempted on every non-skipHTTP case Signed-off-by: MrBeldum <mrbeldum@users.noreply.github.com>
|
@mohit-nagaraj Addressed the remaining CodeRabbit threads in the latest commit:
Ready for another look. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 1d66b954-59f1-44d3-9c15-66602273057a
📒 Files selected for processing (2)
services/registry_service.goservices/registry_service_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
- services/registry_service_test.go
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.
CodeRabbit: default CheckRedirect can keep Authorization across same-host HTTPS→HTTP redirects. Reject redirects when the original request carried Authorization, and reject non-HTTPS redirect targets otherwise. Signed-off-by: MrBeldum <mrbeldum@users.noreply.github.com>
|
Addressed the latest CodeRabbit finding: the registry HTTP client now rejects redirects when the original request carried |
|
@mohit-nagaraj All open CodeRabbit threads are already addressed on the current tip (
Ready for re-review when convenient. |
|
LGTM |
The comments have been addressed
Summary
2xxresponses.401/403are treated as authentication failures with actionable errors that identify the registry without leaking credentials.https://registry URL before sending Basic auth.401still indicates/v2/reachability (auth challenge).2xx,401,403, unexpected status, transport failure, incomplete credentials, HTTP+credentials rejection, exact Basic auth payload decoding, URL label redaction, and empty URL.Fixes #131
Test plan
go test ./services/ -count=1go test ./services/ -run 'TestTestCustomRegistryConnection|TestTestDockerHubConnection_401IsSuccess|TestCustomRegistryLabel' -v