make custom inline headers bootstrap configurable#17330
make custom inline headers bootstrap configurable#17330snowp merged 9 commits intoenvoyproxy:mainfrom
Conversation
Signed-off-by: wbpcode <wbphub@live.com>
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
Signed-off-by: wbpcode <wbphub@live.com>
adisuissa
left a comment
There was a problem hiding this comment.
Left an API comment and some drive-by code comments.
source/server/server.cc
Outdated
| } | ||
| } | ||
|
|
||
| bool canBeRegisteredAsInlineHeaderOrNot(const Http::LowerCaseString& header_name) { |
There was a problem hiding this comment.
nit: canBeRegisteredAsInlineHeader
source/server/server.cc
Outdated
| void registerCustomInlineHeadersFromBootstrap( | ||
| const envoy::config::bootstrap::v3::Bootstrap& bootstrap) { | ||
| for (const auto& inline_header : bootstrap.inline_headers()) { | ||
| Http::LowerCaseString lower_case_name(inline_header.inline_header_name()); |
test/server/server_test.cc
Outdated
| // instantiation of InstanceImpl. If InstanceImpl is instantiated again and the inline header is | ||
| // registered again, the assertion will be triggered. |
There was a problem hiding this comment.
Is there a test that covers this scenario? If not, can you please add one.
| string inline_header_name = 1 [(validate.rules).string = {min_len: 1}]; | ||
|
|
||
| // The type of the header that is expected to be set as the inline header. | ||
| InlineHeaderType inline_header_type = 2; |
There was a problem hiding this comment.
I think that the following PGV constraint (validate.rules).enum.defined_only = true can be added.
Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: wbpcode <wbphub@live.com>
|
/retest |
|
Retrying Azure Pipelines: |
|
@alyssawilk Now the API is ready. When it is convenient for you, can you advance this work? 😄 |
alyssawilk
left a comment
There was a problem hiding this comment.
Looks great! this will be a really useful feature going forward :-)
| } | ||
| } | ||
|
|
||
| bool canBeRegisteredAsInlineHeader(const Http::LowerCaseString& header_name) { |
| string inline_header_name = 1 [(validate.rules).string = {min_len: 1}]; | ||
|
|
||
| // The type of the header that is expected to be set as the inline header. | ||
| InlineHeaderType inline_header_type = 2 [(validate.rules).enum = {defined_only: true}]; |
There was a problem hiding this comment.
vadd pgv for well_known_regex: HTTP_HEADER_NAME?
| inline_header.inline_header_name())); | ||
| } | ||
| switch (inline_header.inline_header_type()) { | ||
| case envoy::config::bootstrap::v3::CustomInlineHeader::REQUEST_HEADER: |
There was a problem hiding this comment.
Can one add as a custom inline header a header which is already an inline header? I think it's worth a unit test for this.
There was a problem hiding this comment.
Can one add as a custom inline header a header which is already an inline header?
Yes.
I think it's worth a unit test for this.
I think this scenario has been verified in the test of CustomInlineHeaderRegistry::registerInlineHeader itself. We can register the header with the same name as the inline header repeatedly without any negative effects.
envoy/test/common/http/header_map_impl_test.cc
Lines 365 to 368 in d483098
envoy/test/common/http/header_map_impl_test.cc
Lines 389 to 399 in d483098
| is_registered = true; | ||
| } | ||
|
|
||
| EXPECT_TRUE( |
There was a problem hiding this comment.
how about an integration test (protocol integration test?) that the headers / trailers end up elided?
There was a problem hiding this comment.
get it. I think we can verify this problem with a few simple lines of tests in existing test cases.
There was a problem hiding this comment.
Where did we land on this? Don't see an integration test
Signed-off-by: wbpcode <wbphub@live.com>
|
/retest |
|
Retrying Azure Pipelines: |
alyssawilk
left a comment
There was a problem hiding this comment.
Looks great! Throwing over to @snowp for second pass
|
Also @adisuissa can you do another API stamp? |
snowp
left a comment
There was a problem hiding this comment.
This LGTM, just one question re adding an integration test
|
@snowp Thanks. @alyssawilk's suggestion is to verify that a header or trailer registered as an inline header can be folded correctly. In practice, integration tests are not necessarily required to verify this problem. |
|
/retest |
|
Retrying Azure Pipelines: |
|
/retest |
|
Retrying Azure Pipelines: |
|
I think normally we encourage adding an integration test even if it's not strictly necessary since they tend to catch unexpected issues (or provide more reliable regression tests). That said it seems like we're okay skipping it in this case, so let's get this merged |
…bridge-stream * upstream/main: (140 commits) quiche: remove google quic support (envoyproxy#17465) runtime: removing envoy.reloadable_features.check_ocsp_policy (envoyproxy#17524) upstream: not trying to do HTTP/3 where not configured (envoyproxy#17454) api: Remove confusing line about auto-generation (envoyproxy#17536) v2: removing bootstrap (envoyproxy#17523) connpool: Fix crash in pool removal if the cluster was already deleted (envoyproxy#17522) Enhance the comments clearly (envoyproxy#17517) mysql proxy: connection attributes parsing (envoyproxy#17209) [ci] fix false positive CVE scan from node (envoyproxy#17510) Fixing Envoy Mobile factory strings (envoyproxy#17509) http3: validating codec (envoyproxy#17452) quic: add QUIC upstream stream reset error stats (envoyproxy#17496) thrift proxy: move UpstreamRequest into its own file (envoyproxy#17498) docs: Fixed FaultDelay docs. (envoyproxy#17495) updates links to jaegertracing-plugin.tar.gz (envoyproxy#17497) http: make custom inline headers bootstrap configurable (envoyproxy#17330) deps: update yaml-cpp to latest master (envoyproxy#17489) improving tracer coverage (envoyproxy#17493) Increase buffer size of `Win32RedirectRecords` (envoyproxy#17471) ext_proc: Fix problem with buffered body mode with empty or no body (envoyproxy#17430) ... Signed-off-by: Garrett Bourg <bourg@squareup.com>
Commit Message: ensure that the inline cookie header will be folded correctly Additional Description: This PR is a supplement to #17330 and #14969 and will finally close #17234. This PR mainly did following works: update insertByKey to choose suitable delimiter for inline header. update parseCookie to avoid unnecessary iteration for parsing cookie value. Risk Level: Low. Testing: Add. Docs Changes: N/A. Release Notes: N/A. Signed-off-by: wbpcode <wbphub@live.com>
…7330) Signed-off-by: wbpcode <wbphub@live.com>
…roxy#17560) Commit Message: ensure that the inline cookie header will be folded correctly Additional Description: This PR is a supplement to envoyproxy#17330 and envoyproxy#14969 and will finally close envoyproxy#17234. This PR mainly did following works: update insertByKey to choose suitable delimiter for inline header. update parseCookie to avoid unnecessary iteration for parsing cookie value. Risk Level: Low. Testing: Add. Docs Changes: N/A. Release Notes: N/A. Signed-off-by: wbpcode <wbphub@live.com>
Signed-off-by: wbpcode wbphub@live.com
Commit Message: make custom inline headers bootstrap configurable
Additional Description:
Make custom inline headers bootstrap configurable. Check #17234 for more background info.
Risk Level: Mid.
Testing: Added.
Docs Changes: N/A.
Release Notes: Wait.