-
Notifications
You must be signed in to change notification settings - Fork 870
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
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? |
@@ -20,7 +20,8 @@ public String transport(ChannelAndMethod channelAndMethod, @Nullable Void unused | |||
@Nullable | |||
@Override | |||
public String peerName(ChannelAndMethod channelAndMethod, @Nullable Void unused) { | |||
return channelAndMethod.getChannel().getConnection().getAddress().getHostName(); |
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.
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.
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.
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)