Repository navigation
Description
The source workload's SPIFFE ID is stamped into filter state but does not contribute to Envoy's upstream connection-pool hash key. Two pods on the same node with different ServiceAccounts talking to the same upstream share one connection pool, so whichever source happened to create the connection supplies the client certificate that every later request rides — including requests from the other workload.
The destination does not catch it, stamps the wrong identity into XFCC, and any RBAC or ext_authz decision keyed on source identity then authorizes the wrong workload.
This predates today's changes. It is not a regression from #815 (the previous netns-path key was also envoy.string); release two made it neither better nor worse. Found while investigating #829, which it is not the cause of.
The chain
agent/internal/xds/proxy/networkfilter.go:175stamps the source identity withFactoryKey: "envoy.string"→ Envoy constructs aRouter::StringAccessorImpl.source/common/router/string_accessor_impl.h:8—StringAccessorImpl : public StringAccessoronly. It does not implementHashable.source/common/network/transport_socket_options_impl.cc:47-53—CommonUpstreamTransportSocketFactory::hashKeyfolds a downstream-shared filter-state object into the hash only ifdynamic_cast<const Hashable*>succeeds.
So aether.source.spiffe_id contributes zero bytes to the pool hash. Pools are keyed by cluster + host and are shared across source identities on the node proxy.
Why the destination cannot catch it
agent/internal/xds/proxy/transportsocket.go:35-49 (DownstreamTransportSocket) sets RequireClientCertificate: true with a validation context carrying no SAN matchers — trust-domain membership only. Any workload in aether.internal satisfies it. XFCC is then stamped SANITIZE_SET from that peer certificate (agent/internal/xds/proxy/ingress.go:231-235), so the wrong source identity is propagated as though verified.
Impact
On a node hosting multiple ServiceAccounts — which is the normal case — XFCC-based authorization is not sound. Concretely, common/extensionfilter/ RBAC rules and the OPA preset behind the authz canary (which has a source-identity rule) can admit or deny based on an identity that is not the caller's.
Severity is bounded by requiring co-location on one node and a shared upstream, and by the fact that both identities are legitimate mesh workloads — this is not an escalation from outside the mesh. It is a workload-to-workload authorization boundary failure inside it.
Fix
Preferred: make the source-identity filter-state object Hashable so it lands in CommonUpstreamTransportSocketFactory::hashKey. Either upstream a Hashable string filter-state factory, or a hashable: true knob on set_filter_state. aether already carries Envoy patches, so this is tractable.
Interim, not recommended: fold the source identity into something already hashed. serverNameOverride is hashed (transport_socket_options_impl.cc:28-30) and aether's upstream SNI is currently only a port number — but that changes what the destination demuxes on, so it trades one correctness problem for another.
Independently worth doing (transportsocket.go:35-49): the destination cannot pin a specific ServiceAccount, since any mesh peer may legitimately call. It can require a well-formed spiffe://<td>/ns/*/sa/* URI SAN via a prefix matcher, which rejects a non-workload certificate and makes the XFCC value structurally trustworthy.
Until fixed: document that upstream connection reuse can carry a foreign source identity, and that XFCC-based RBAC/ext_authz decisions are not sound on a node hosting multiple ServiceAccounts.
Test that would have caught it
Two pods with different ServiceAccounts on one node, both calling the same upstream; assert the destination's XFCC URI SAN matches the actual caller on every request, not just the first. Nothing in the tree does this today — existing coverage exercises one identity per node path, which is exactly the shape that hides a pool-key omission.
test/envoy_validate cannot cover this: it is a runtime pooling property with no configuration expression at all.
Status of the evidence
Derived from reading the aether and Envoy sources at the pinned Envoy revision (1.40.0-dev.20260904.13144fb), with the three links above verified individually. It has not yet been demonstrated live. The integration test described above is the cheapest demonstration and should be written before the fix, so the fix has a failing test to turn green.
Activity
bpalermo commentedon Sep 19, 2026
Severity raised: under HTTP/2 this is the steady state, not a race
The original report framed this as connection reuse carrying a foreign identity — a race whose window is one pooled connection's lifetime. That understated it.
aether's upstream is HTTP/2 (
agent/internal/xds/proxy/transportsocket.go:103,AlpnProtocols: []string{"h2"}). So many streams from many source pods multiplex onto one upstream connection, whose client certificate was fixed by whichever source happened to create it. The destination then stamps XFCCSANITIZE_SETfrom that single certificate (ingress.go:231-235), and itsDownstreamTransportSocketpins no client SANs (transportsocket.go:35-49) so it cannot object.Under h2 this is not a race with a window. It is the steady state on any node hosting more than one ServiceAccount — which is the normal case. Every RBAC and ext_authz decision keyed on source SPIFFE ID is unsound there, continuously.
Not the same defect as #829
Worth recording, since the two were investigated together and the link looked plausible. The hash-key omission cannot produce #829's symptom: connection pools are per host (
ThreadLocalClusterManagerImplkeys its pool containers byHostConstSharedPtr), so a pool cannot hand back a connection to a different destination; and every transport socket within one cluster carries identicalsanURIsandsni(egress.go:466is a single call;transportsocketmatch.go:120-127varies only the client-cert SDS name), so even a maximally wrong socket selection cannot change what is expected of the peer.So: this omission mis-attributes identity on success; it cannot mis-report it on failure. #829 has a separate and now-identified cause (upstream TLS session resumption). This issue stands entirely on its own, and at higher severity than #829 — #829 fails closed and is visible as errors, this one fails open and is invisible by construction.
Additional evidence for the fix
A cheap discriminator that would prove the leak end to end, one line in
agent/internal/xds/proxy/accesslog.go:If a stream from one workload logs its own
source_spiffe_idwhile the destination's XFCC reports a different identity for the same request, the leak is demonstrated rather than derived.:PLAINis mandatory — the formatter defaults to TYPED and renders-, the same trap already documented atnetworkfilter.go:106-108. The filter-state key already exists and currently has exactly one reader; this is its identity twin.Until the
Hashablefix lands, the runbook should state that XFCC-derived authorization is not sound on a node hosting multiple ServiceAccounts.bpalermo commentedon Sep 20, 2026
Demonstrated: the mechanism is real, aether is not exposed. Refuted at step 4.
Run against the pinned proxy (
aether-proxy:cff8beb8…, 1.40.0-dev) in a newruntime harness,
//test/mtlspool— PR #841. Both directions were measured, sothis is no longer derived.
The link that fails
Steps 1-3 of the chain are all confirmed.
envoy.string→Router::StringAccessorImpl, notHashable;CommonUpstreamTransportSocketFactory::hashKeyfolds a downstream sharedfilter-state object into the pool hash only behind a successful
dynamic_cast<const Hashable*>; the source SPIFFE ID contributes zero bytesto the pool key. That part of the report is exactly right, and I reproduced its
consequence.
The step that fails is the one immediately after:
They are not shared. Every mesh cluster the node proxy builds sets
connection_pool_per_downstream_connection: true—proxy.NewServiceCluster/proxy.NewTCPServiceCluster, fed bySnapshotCache.perDownstreamConnectionPool()(=!c.edge), covering the HTTPservice clusters (
cache/cluster.go:338,356,423) and the TCP floor(
cache/capture.go:322). Envoy mixes the downstream connection id into the poolhash in both pool paths —
cluster_manager_impl.cc:2189(HTTP) and:2317(TCP), via
ConnectionImplBase::hashKey→addIdToHashKey(hash, id()). One poolper downstream connection, and on the capture/outbound path a downstream
connection is one pod, so there is nothing for a second source to inherit.
The edge passes
false, correctly — it has one identity, which cannot leak intoitself.
The measurement
Two source workloads, different ServiceAccounts, one node, same upstream.
The destination reports the URI SAN it actually verified — the same value the
inbound listener stamps into XFCC (
SANITIZE_SET+set_current_client_cert_details.uri).--concurrency 1, because pools are perworker thread.
Negative control — the flag removed, i.e. the configuration this issue assumed:
11/11, all on one upstream HTTP/2 connection. The escalation in the follow-up
comment was right: under h2 this is steady state, not a race. The Envoy defect
this issue describes is completely real — it simply requires a configuration
aether does not have.
Production configuration:
Every request, own identity, own connection. The node identity has its own
certificate in the harness so an
on_no_match(#686/#825) cannot be mistaken fora pooling leak.
So XFCC-derived RBAC/ext_authz is sound here — conditionally
Not because the identity is in the pool key (it is not), but because the pool is
never shared. That makes
connection_pool_per_downstream_connectionsecurityconfiguration on the node proxy, not a throughput knob — and nothing said so
where someone tuning connection pooling would look. That was the real gap this
issue exposed, and it is now closed three ways in #841:
TestNodeProxyPerSourceClustersPoolPerDownstreamConnectionfails the build ifany cluster with a per-source
transport_socket_matcherloses the flag(verified red by flipping
perDownstreamConnectionPool());//test/mtlspoolkeeps the runtime property under test, with the negativecontrol as its own proof that the green result can fail;
note is upgraded from derived to demonstrated and says plainly not to turn the
flag off.
The observability suggested here shipped
source_spiffe_idis now an access-log attribute (:PLAIN, as flagged — TYPEDrenders
-for aStringAccessorImpl), and the pinned Envoy parses it in//test/envoy_validate. Joined to the destination line'sdownstream_peer_uri_san(#824) onx_request_id, the claimed and the verifiedidentity must agree. A disagreement is a matcher miss or a pooling leak — the
discriminator this issue asked for, in place regardless of the verdict.
Not established
loopback; the production proxy's many workers only make sharing less likely.
NewUDPServiceCluster) carries no flag and no client certificate — meshUDP is plaintext by design, so there is no identity to leak, but nothing here
examined it.
Carried forward as separate issues
Hashablefix is still the right end state: it would let the mesh dropconnection_pool_per_downstream_connectionand recover cross-source upstreammultiplexing, which is real throughput currently being paid for correctness.
The flag is a mitigation, not a design.
doing:
DownstreamTransportSocket(transportsocket.go:35-49) pins no clientSANs, so a
spiffe://<td>/ns/*/sa/*prefix matcher would make the XFCC valuestructurally trustworthy.
Closing as refuted-as-reported. The analysis was correct about Envoy and found a
genuine documentation and regression-guard gap; it was wrong about aether's
exposure.
bpalermo commentedon Sep 20, 2026
Refuted as reported — see the demonstration above. Follow-ups split out per finding: #842 (make the filter state Hashable so the mitigation flag can come off) and #843 (pin a workload-SVID URI SAN prefix on the inbound validation context). PR #841 carries the harness, the access-log discriminator, the regression guard and the runbook update.
test(agent): demonstrate #831 against a real Envoy — the leak is real…
docs(038): decide D2, restate Q2 against the real mechanism, add the …
docs(038): Q2 answered from source — Phase 4b is one QUIC cluster per…
docs(038): fold east-west QUIC in as a requirement and reassess the w…
fix(038): per-source alt_stat_name on the quic: twins (#960) (#962)