-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
headers: consistent validation #34205
Conversation
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for improving code health!
Some drive-by comments
// Reject key if it is an invalid header string | ||
return {}; | ||
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.consistent_header_validation")) { | ||
if (!Http::HeaderUtility::headerValueIsValid(str)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The intention here is checking the header key/name . So I think we should use utility headerNameIsValid
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah good catch - I'd been going off the bug which I think referenced the wrong helper. looks like same thing with the formatter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, tracking the code into here , we can see formatter is also using header key/name
Http::TestRequestHeaderMapImpl header_map{{"referer", "dogs.com"}}; | ||
Protobuf::Arena arena; | ||
HeadersWrapper<Http::RequestHeaderMap> headers(arena, &header_map); | ||
auto header = headers[CelValue::CreateStringView("dogs.com\n")]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should test a invalid header key/name in particular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so this does exercise the test code. did you just prefer an invalid string that looks like a key? PTAL
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, i was preferring a invalid string that looks like a key. Thanks for updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Defer to @yanavlasov for final review and merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a spelling fix
@@ -52,6 +52,10 @@ minor_behavior_changes: | |||
``%UPSTREAM_REMOTE_PORT%`` and ``%UPSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%`` access log format specifiers. | |||
This behavior can be reverted by setting the runtime guard | |||
``envoy.reloadable_features.upstream_remote_address_use_connection`` to false. | |||
- area: http | |||
change: | | |||
Changing header validation checks in the substitution format utility and CEL code to do RCF complaint header validation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing header validation checks in the substitution format utility and CEL code to do RCF complaint header validation. | |
Changing header validation checks in the substitution format utility and CEL code to do RFC complaint header validation. |
Needs fixing merge conflict. /wait |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
/retest |
/wait on CI |
/wait on CI |
/wait on CI and debug cleanup |
Signed-off-by: Alyssa Wilk <alyssar@chromium.org>
Risk Level: low
Testing: existing tests
Docs Changes: n/a
Release Notes: inline
[Optional Runtime guard:] yes