Skip to content
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

Merged
merged 1 commit into from
Feb 8, 2022
Merged

Avoid potential for reverse name lookup #5305

merged 1 commit into from
Feb 8, 2022

Conversation

trask
Copy link
Member

@trask trask commented Feb 3, 2022

Follow-up on @laurit's #5297 (review)

@trask trask requested a review from a team February 3, 2022 20:34
@anuraaga
Copy link
Contributor

anuraaga commented Feb 3, 2022

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();
Copy link
Contributor

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.

Copy link
Contributor

@laurit laurit left a 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.

@trask
Copy link
Member Author

trask commented Feb 8, 2022

All server instrumentations that implement peerName probably also cause a name lookup.

I opened #5317 to track this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants