Enforce ServiceEntry exportTo visibility in ztunnel#1815
Enforce ServiceEntry exportTo visibility in ztunnel#1815syn-zhu wants to merge 1 commit intoistio:masterfrom
Conversation
Add export_to field to the Service struct, populated from the new proto field added in the companion istio/istio PR. Filter services by namespace visibility at two critical lookup points: 1. DNS resolution (find_server): services not visible to the source pod's namespace are filtered out before find_best_match, preventing cross-namespace hostname resolution and VIP leakage. 2. VIP routing (find_upstream): get_by_vip checks visibility against the source workload's namespace, preventing cross-namespace VIP traffic routing. The is_visible_to check follows Istio exportTo semantics: "." = same namespace only "*" = all namespaces empty = all namespaces (default) specific name = that namespace only The check is O(1) for the common case (empty export_to = visible to all). Companion to istio/istio#59653 Fixes istio/istio#59652 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
😊 Welcome @syn-zhu! This is either your first contribution to the Istio ztunnel repo, or it's been You can learn more about the Istio working groups, Code of Conduct, and contribution guidelines Thanks for contributing! Courtesy of your friendly welcome wagon. |
|
|
|
Hi @syn-zhu. Thanks for your PR. I'm waiting for a istio member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Summary
Enforce
exportTonamespace visibility for ServiceEntries in ztunnel, preventing cross-namespace DNS resolution and VIP routing leakage in multi-tenant ambient deployments.Changes
workload.proto: Addedexport_tofield toServicemessage (matches companion istiod PR)service.rs: Addedexport_tofield toServicestruct,is_visible_to(client_ns)method, namespace-scopedget_by_vip, and unscopedget_by_vip_unscopedfor inbound pathsdns/server.rs:find_serverfilters services byis_visible_to(client.namespace)beforefind_best_matchstate.rs:find_upstreampassessource_workload.namespacetoget_by_vipHow it works
istiod populates the
export_tofield on eachworkloadapi.Servicefrom the ServiceEntry'sspec.exportTo(withDefaultServiceExportTomesh config fallback). ztunnel checks this field at two critical lookup points:get_by_vipchecks visibility against the source workload's namespace, preventing cross-namespace VIP traffic routingThe check is O(1) for the common case (empty
export_to= visible to all).Companion PR
istiod-side changes (proto + population): istio/istio#59653
Fixes istio/istio#59652
🤖 Generated with Claude Code