Encode the service authority in xDSNameResolver#10207
Merged
ejona86 merged 22 commits intogrpc:masterfrom Jul 14, 2023
Merged
Conversation
ejona86
reviewed
Jun 12, 2023
…nsead of piggy backing on the safe chars for the path
Member
|
I'm wary of com.google.common.net after #9376 . Since this is being used for android and non-android, we need to make sure there's not issues internally with the usage. |
Contributor
Author
|
I hit the same issue as #9376. To avoid build errors to android, created a in house version of the escaping instead. |
ejona86
reviewed
Jul 13, 2023
Member
ejona86
left a comment
There was a problem hiding this comment.
Unicode is tricky. It looks like previously we'd just let it through here. I don't know if that is a good idea long-term, but let's preserve that behavior for now.
ejona86
approved these changes
Jul 14, 2023
ejona86
requested changes
Jul 14, 2023
ejona86
approved these changes
Jul 14, 2023
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Encode the service authority before passing it into gRPC util in the xDS name resolver to handle xDS requests which might contain multiple slashes. Example: xds:///path/to/service:port.
As currently the underlying Java URI library does not break the encoded authority into host/port correctly simplify the check to just look for '@' as we are only interested in checking for user info to validate the authority for HTTP.
This change also leads to few changes in unit tests that relied on this check for invalid authorities which now will be considered valid.
Just like #9376, depending on Guava packages such as URLEscapers or PercentEscapers leads to internal failures(Ex: Unresolvable reference to com.google.common.escape.Escaper from io.grpc.internal.GrpcUtil). To avoid these issues create an in house version that is heavily inspired by grpc-go/grpc.
cc: @ejona86