Repository navigation
feat(agent): log the verified mTLS peer identity, and validate the access log against a real Envoy (#824) - #827
Merged
Conversation
…cess log against a real Envoy (#824) Every identity field in an access-log line was something the control plane baked into the emitting pod's own config, so a line could say who it THINKS it is but never who the other end actually proved to be. Validating #815 release two needed exactly that — "did any workload's traffic arrive as the node agent's identity?" — and the answer had to be inferred from a match counter and from OPA's view of the source's own claim. Each hop now logs the one peer it verified: - reporter=destination (the per-pod inbound listener): `downstream_peer_uri_san` = %DOWNSTREAM_PEER_URI_SAN%, the CALLER's SPIFFE ID as validated against the mesh trust bundle. - reporter=source (outbound_http, capture_http): `upstream_peer_uri_san` = %UPSTREAM_PEER_URI_SAN%, the server certificate the destination proxy presented — the client-side view of the #638 cross-wiring, which today only shows up as envoy_cluster_ssl_fail_verify_san telling you SOME peer failed. Split by reporter because each side has exactly one interesting peer and the other operator renders "-" on every line. Both render "-" when the hop is not mTLS, so SPIRE-off output is unchanged apart from one extra "-" field. Cardinality is bounded by the number of ServiceAccounts. Also closes a hole in the validation gate that this change walked straight into: //test/envoy_validate never enabled access logging, so the entire access-log config — ~30 substitution operators, the DYNAMIC_METADATA and FILTER_STATE specs, the filter tree — had never been through a real Envoy config loader. The node bootstrap now carries it (plus the otel_collector cluster the logger names). Verified non-vacuous: replacing an operator with a bogus one fails the gate with `error initializing configuration`, and both new operators pass against the pinned 1.40.0-dev binary. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr
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.
Closes #824.
Every identity field in an access-log line was something the control plane baked
into the emitting pod's own config, so a line could say who it THINKS it is but
never who the other end actually proved to be. Validating #815 release two needed
exactly that — "did any workload's traffic arrive as the node agent's identity?" —
and the answer had to be inferred from a match counter and from OPA's view of the
source's own claim.
Each hop now logs the one peer it verified:
downstream_peer_uri_san= %DOWNSTREAM_PEER_URI_SAN%, the CALLER's SPIFFE ID as validated against the
mesh trust bundle.
upstream_peer_uri_san=%UPSTREAM_PEER_URI_SAN%, the server certificate the destination proxy
presented — the client-side view of the Transient cross-service mTLS identity mis-binding during concurrent proxy-restart + service roll (failed closed) #638 cross-wiring, which today only
shows up as envoy_cluster_ssl_fail_verify_san telling you SOME peer failed.
Split by reporter because each side has exactly one interesting peer and the
other operator renders "-" on every line. Both render "-" when the hop is not
mTLS, so SPIRE-off output is unchanged apart from one extra "-" field.
Cardinality is bounded by the number of ServiceAccounts.
Also closes a hole in the validation gate that this change walked straight into:
//test/envoy_validate never enabled access logging, so the entire access-log
config — ~30 substitution operators, the DYNAMIC_METADATA and FILTER_STATE specs,
the filter tree — had never been through a real Envoy config loader. The node
bootstrap now carries it (plus the otel_collector cluster the logger names).
Verified non-vacuous: replacing an operator with a bogus one fails the gate with
error initializing configuration, and both new operators pass against thepinned 1.40.0-dev binary.
Why now
Validating #815 release two, the destination-side check the plan called for could not be run at all — this is the instrument that was missing. It also answers the #638 question from the client side.
Verification
//agent/internal/xds/... //agent/internal/cni/server:all //test/envoy_validate:all //website:allgreen (10 targets); lint clean. The Envoy gate was proved non-vacuous by injecting%NOT_A_REAL_OPERATOR_XYZ%and watching it fail, then restoring. Generated node bootstrap carries 2 downstream operators (the two inbound HCMs) and 1 upstream (outbound).No chart change. Refs #815, #638.
🤖 Generated with Claude Code
https://claude.ai/code/session_01NArCRTfMPZkw4Y97U9Gdsr