fix(srv6): fail closed in DSR eligibility for nil IPAM and dual-stack#26
Merged
Merged
Conversation
Two fail-open gaps in dsrEligible: - the pod-backed backend check (the guard that keeps host-network backed services like the apiserver off DSR) was wrapped in 'if s.felixServerIpam != nil', so a nil IPAM view skipped it entirely. Treat nil as fail-closed: without the IPAM view we cannot verify backends are pod-backed, so keep the service on cnat. - dual-stack services were accepted: buildDSRServices programs only the IPv6 ClusterIP while GetLocalService suppresses cnat for ALL ClusterIPs of a DSR service, so the IPv4 ClusterIP got neither path (blackhole). Reject any service with an IPv4 ClusterIP.
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.
What
Two fail-open gaps in
dsrEligible:if s.felixServerIpam != nil, so a nil IPAM view skipped the whole guard. A security guard must not depend on a nilable field.buildDSRServicesprograms only the IPv6 ClusterIP whileGetLocalServicesuppresses cnat for all ClusterIPs of a DSR service, so the IPv4 ClusterIP got neither path.Fix
felixServerIpam == nil→ fail closed (keep on cnat)Review finding
Info I4 (nil-guard fail-open) + Low L5 (dual-stack blackhole). Both harden the same eligibility gate.
Test
GOOS=linux go vet ./calico-vpp-agent/services/...green (services package can't run natively on darwin: config→netlink).