Repository navigation
Conversation
Signed-off-by: RAJATH MOHARE <rajath@digiscrypt.com>
✅ Deploy Preview for cerulean-figolla-1f9435 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4da3a36ff0
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| fmt.Errorf("IP address %s in the loopback range is only supported when using the Host infrastructure", epIP.Address), | ||
| status.RouteReasonInvalidAddress, | ||
| ) | ||
| } else if ip.Unmap().IsUnspecified() && !runningOnHost { |
There was a problem hiding this comment.
Update the rejected egctl test endpoint
In the checked TestTranslate backend-endpoint case (internal/cmd/egctl/testdata/translate/in/backend-endpoint.yaml:45), the Translator is created with its zero-value RunningOnHost=false, but that fixture still uses 0.0.0.0 and the golden expects the Backend to be accepted. This branch therefore emits Accepted=False (and ResolvedRefs=False for the route), making the unconditional comparison at internal/cmd/egctl/translate_test.go:437 fail whenever go test ./internal/cmd/egctl runs; update the fixture and golden to use a permitted endpoint along with this validator change.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Good catch. Moved that fixture endpoint to 1.1.1.1 (the address other Backend testdata uses) and regenerated backend-endpoint.all.yaml, so the Backend stays Accepted there and the rejection is only covered by TestValidateIPRunningOnHost. go test ./internal/cmd/egctl and gen-check are clean locally.
The egctl translate fixture used 0.0.0.0 as a Backend endpoint, which the new check rejects, so TestTranslate/backend-endpoint and gen-check both failed. Use a routable address there instead; the rejection is already covered by TestValidateIPRunningOnHost. gocritic flagged the three-branch if-else chain in validateIP, so it is a switch now with no behavior change. Signed-off-by: RAJATH MOHARE <rajath@digiscrypt.com>
|
Pushed fixes for the lint and gen-check/coverage-test failures: validateIP is a switch now (gocritic flagged the three-branch if-else) and the egctl backend-endpoint fixture no longer uses 0.0.0.0, with its golden regenerated. No behavior change to the validator itself. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #10657 +/- ##
========================================
Coverage 82.86% 82.86%
========================================
Files 278 278
Lines 44597 44698 +101
========================================
+ Hits 36954 37040 +86
- Misses 7642 7657 +15
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| return status.NewRouteStatusError( | ||
| fmt.Errorf("IP address %s is unspecified and connects to the loopback interface, which is only supported when using the Host infrastructure", epIP.Address), | ||
| status.RouteReasonInvalidAddress, | ||
| ) |
There was a problem hiding this comment.
should we add a default case here?
There was a problem hiding this comment.
Added one, so every path returns from the switch instead of falling through to a trailing return nil.
Signed-off-by: RAJATH MOHARE <rajath@digiscrypt.com>
What this PR does / why we need it:
validateIPininternal/gatewayapi/backend.gois what keeps a Backend from pointing at the proxy's own localhost (the Envoy admin interface listens on127.0.0.1:19000), but it only checksIsLoopback(). The unspecified addresses0.0.0.0and::(and the IPv4-mapped0:0:0:0:0:ffff:0:0) match the CRD address pattern and pass that check, and on Linux aconnect()to the unspecified address is delivered to the local host. A Backend endpoint of0.0.0.0:19000therefore reaches the loopback-only admin listener from any route that references it, outside the Host infrastructure where loopback is supposed to be rejected.The fix treats unmapped unspecified addresses like loopback in
validateIP, the same setisBlockedOIDCDiscoveryAddralready blocks for OIDC discovery. Keeping it in the validator covers every Backend reference path without touching the CRD pattern, and Host mode keeps its existing behavior. New cases inTestValidateIPRunningOnHostfail on main (0.0.0.0,::and the mapped form are accepted) and pass with the change.Which issue(s) this PR fixes:
N/A, no tracking issue.
PR Checklist
git commit -s). See DCO: Sign your work.make generate gen-check,make lint, and the unit-test/coverage build pass. (Flaky e2e failures are not considered breakages, butgen-check,lint, and coverage MUST pass.) Rango test ./internal/gatewayapi/...,go vetandgofmtlocally; relying on CI formake lintandgen-check.release-notes/current/security_updates/10638-backend-unspecified-ip.md.release-notes/current/breaking_changes/.