Avoid potential for reverse name lookup#5305
Conversation
|
I have a feeling this method doesn't have a use case in our codebase - is it possible to add a custom error prone check for it? |
| @Nullable | ||
| @Override | ||
| public String peerName(ChannelAndMethod channelAndMethod, @Nullable Void unused) { | ||
| return channelAndMethod.getChannel().getConnection().getAddress().getHostName(); |
There was a problem hiding this comment.
Apparently it is possible to read the cached hostname from InetAddress with new InetSocketAddress(channelAndMethod.getChannel().getConnection().getAddress(), 0).getHostString(). In this case it doesn't seem to change anything because the address really only has the ip. Added this note in case you find some other place where this could come handy.
laurit
left a comment
There was a problem hiding this comment.
All server instrumentations that implement peerName probably also cause a name lookup.
I opened #5317 to track this |
Follow-up on @laurit's #5297 (review)