Skip to content

OkHttpChannelBuilder#overrideAuthority not compatible with IPv6 hostname #4278

Closed
@OnlyInAmerica

Description

@OnlyInAmerica

What version of gRPC are you using?

1.10.0

What did you expect to see?

Background: I'm using mutual TLS with a LAN client that presents an IPv6 link-local address as an IP SAN in its X509 certificate.

I expected to call OkHttpChannelBuilder.overrideAuthority("FE80::FABB:BFFF:FE01:3A52") to allow hostname verification to pass.

Instead, this call yields an IllegalArgumentException("No host in authority"). If I instead represent the authority as "[FE80::FABB:BFFF:FE01:3A52]", OkHostnameVerifier's VERIFY_AS_IP_ADDRESS regex does not match the address (correctly, I believe, as the square brackets are just a URL disambiguation detail and not part of the hostname), and so the verify mechanism ignores the IP SAN entries.

If you agree this behavior should be changed I'm happy to submit a PR. Perhaps we'd modify GrpcUtil#checkAuthority to strip square brackets from a validated hostname?

Message Sequence Charts (Click to expand)

With OkHttpChannelBuilder.overrideAuthority("FE80::FABB:BFFF:FE01:3A52"):

link-local-hostname-verification-okhostnameverify-fail-nobracket-msc

With OkHttpChannelBuilder.overrideAuthority("[FE80::FABB:BFFF:FE01:3A52]"):

link-local-hostname-verification-okhostnameverify-fail-msc

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions