Skip to content

Encode the service authority in xDSNameResolver#10207

Merged
ejona86 merged 22 commits intogrpc:masterfrom
anicr7:xds_url_encoding_authority
Jul 14, 2023
Merged

Encode the service authority in xDSNameResolver#10207
ejona86 merged 22 commits intogrpc:masterfrom
anicr7:xds_url_encoding_authority

Conversation

@anicr7
Copy link
Contributor

@anicr7 anicr7 commented May 19, 2023

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

@anicr7 anicr7 changed the title URL Encode authority in xDSNameResolver Encode the authority in xDSNameResolver May 19, 2023
@anicr7 anicr7 changed the title Encode the authority in xDSNameResolver Encode the service authority in xDSNameResolver May 19, 2023
@anicr7 anicr7 marked this pull request as ready for review May 19, 2023 23:30
@anicr7 anicr7 requested a review from ejona86 June 13, 2023 18:57
@ejona86
Copy link
Member

ejona86 commented Jul 5, 2023

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.

@anicr7
Copy link
Contributor Author

anicr7 commented Jul 13, 2023

I hit the same issue as #9376. To avoid build errors to android, created a in house version of the escaping instead.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@anicr7 anicr7 requested a review from ejona86 July 14, 2023 19:48
@ejona86 ejona86 merged commit ac35ab6 into grpc:master Jul 14, 2023
@anicr7 anicr7 deleted the xds_url_encoding_authority branch July 21, 2023 18:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants