-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
http: fix and generalize PercentEncoding utility. #11677
Conversation
* Fix an off-by-one bug in PercentEncoding::encode(). It doesn't appear that this utility is used anywhere that this would be security sensitive, but it is used for sendLocalReply() for gRPC messages. * Generalize from '%' to arbitrary visible reserved chars. RFC3986 encoding requires more flexibility, e.g. being able to percent encode `/` or `#`. This change was motivated by a larger patch that provides encoding/decoding of udpa:// URIs, as part of envoyproxy#11264. Risk level: Low Testing: Additional unit tests. Signed-off-by: Harvey Tuch <[email protected]>
/azp run envoy-presubmit |
Azure Pipelines successfully started running 1 pipeline(s). |
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 fixing this!
@@ -158,7 +161,8 @@ class PercentEncoding { | |||
|
|||
private: | |||
// Encodes string view to its percent encoded representation, with start index. | |||
static std::string encode(absl::string_view value, const size_t index); | |||
static std::string encode(absl::string_view value, const size_t index, | |||
const absl::flat_hash_set<char>& reserved_char_set); |
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.
Are there tests or uses of this function? If not, we should delete it.
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.
Nevermind, this helper function is used internally by encode, which does a scan first.
* Fix an off-by-one bug in PercentEncoding::encode(). It doesn't appear that this utility is used anywhere that this would be security sensitive, but it is used for sendLocalReply() for gRPC messages. * Generalize from '%' to arbitrary visible reserved chars. RFC3986 encoding requires more flexibility, e.g. being able to percent encode `/` or `#`. This change was motivated by a larger patch that provides encoding/decoding of udpa:// URIs, as part of envoyproxy#11264. Risk level: Low Testing: Additional unit tests. Signed-off-by: Harvey Tuch <[email protected]>
* Fix an off-by-one bug in PercentEncoding::encode(). It doesn't appear that this utility is used anywhere that this would be security sensitive, but it is used for sendLocalReply() for gRPC messages. * Generalize from '%' to arbitrary visible reserved chars. RFC3986 encoding requires more flexibility, e.g. being able to percent encode `/` or `#`. This change was motivated by a larger patch that provides encoding/decoding of udpa:// URIs, as part of envoyproxy#11264. Risk level: Low Testing: Additional unit tests. Signed-off-by: Harvey Tuch <[email protected]> Signed-off-by: yashwant121 <[email protected]>
Fix an off-by-one bug in PercentEncoding::encode(). It doesn't appear that this utility is used
anywhere that this would be security sensitive, but it is used for sendLocalReply() for gRPC
messages.
Generalize from '%' to arbitrary visible reserved chars. RFC3986 encoding requires more
flexibility, e.g. being able to percent encode
/
or#
.This change was motivated by a larger patch that provides encoding/decoding of udpa:// URIs, as part
of #11264.
Risk level: Low
Testing: Additional unit tests.
Signed-off-by: Harvey Tuch [email protected]