Skip to content

A cluster published with an empty trust domain has no SAN pin at all, silently #832

Closed

Description

@bpalermo

When the agent's trust domain is empty, a mesh cluster is published with no server-identity pin at all. The handshake then proves only trust-domain membership — any workload in aether.internal satisfies it. Nothing asserts the window, counts it, or logs it.

This is a silent authentication downgrade whose only trace today is a code comment.

The path

agent/internal/xds/cache/mtls.go:107-113 — when st.trustDomain == "", sanURIs stays nil.

agent/internal/xds/proxy/transportsocket.go:117-121 — the len(sanURIs) == 0 branch emits a plain ValidationContextSdsSecretConfig with no match_typed_subject_alt_names.

The comment at mtls.go:103-106 acknowledges this as the deliberate lesser evil versus emitting spiffe:///ns/… with an empty trust domain — which is the exact failure that took down rev222 (#815/#819: SDS names nobody serves, endpoints demoted permanently, no alert). Choosing the unpinned form over the unservable one is right. Shipping it silently is not.

The bound is "one snapshot", but nothing enforces or observes that bound, so a window that lasts longer than intended looks identical to one that does not happen at all.

Why it matters beyond the window

Combined with any path that puts a foreign endpoint in a cluster's load assignment, an unpinned cluster turns a would-be rejection into a clean handshake and a delivered request, with nothing logged or counted anywhere. That is the fail-open direction; the pin is what makes these failures loud. See #829, where the pin is what caught the problem.

Fix

  1. At mtls.go:107-113, when st.trustDomain == "", emit a WARN once per snapshot naming the affected clusters, and increment aether.agent.identity.cluster_unpinned. Seed the counter at zero — an unseeded zero reads as a false zero, which this repo has been bitten by before.
  2. Extend trustdomain_test.go, which already covers the empty-trust-domain path, to assert the counter and the WARN rather than only the absence of spiffe:///.
  3. test/envoy_validate can cover the config-shape half: assert every mesh cluster's upstream TLS context carries a non-empty match_typed_subject_alt_names. That is a genuine gate and worth adding — unlike the semantic checks in Back-to-back proxy rolls make pods serve another workload's SVID (three nodes, 65s, silent) #829, this one has a config expression.

Found while investigating #829. Not its cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions