proxy_protocol: support format_string TLVs in upstream transport socket#46068
Open
davidvo-lyft wants to merge 1 commit into
Open
proxy_protocol: support format_string TLVs in upstream transport socket#46068davidvo-lyft wants to merge 1 commit into
davidvo-lyft wants to merge 1 commit into
Conversation
The upstream proxy_protocol transport socket only read each added_tlvs entry's static value, silently ignoring entries that use format_string. Parse the format strings into formatters at config time and evaluate them per connection, emitting the result in the proxy protocol v2 header, and reject entries that set both or neither of value/format_string. Fixes envoyproxy#45130 Signed-off-by: David Vo <davidvo@lyft.com>
|
Hi @davidvo-lyft, welcome and thank you for your contribution. We will try to review your Pull Request as quickly as possible. In the meantime, please take a look at the contribution guidelines if you have not done so already. |
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.
The upstream proxy_protocol transport socket only read each
added_tlvsentry's staticvalue, silently ignoring entries that useformat_string. This parses the format strings into formatters at config time and evaluates them per connection into the proxy protocol v2 header, mirroring the tcp_proxy filter's TLV handling. It also rejects entries that set both or neither ofvalue/format_string.One design question before this is final: the formatters are evaluated against the upstream connection's stream info (what the transport socket has), so connection/machine-level substitutions like
%HOSTNAME%(the use case in #45130) work, but downstream-request-scoped substitutions are not populated. Is upstream-connection stream info the intended scope, or would you prefer the downstream request's stream info be plumbed through? Happy to adjust; I'll add an integration test once the scope is confirmed.Risk Level: Low
Testing: proxy_protocol_test — new red->green case for a format_string TLV, plus validation cases.
Docs Changes: n/a (proto field already documented)
Release Notes: changelog added
Fixes #45130