Skip to content

Avoid potential for reverse name lookup#5305

Merged
trask merged 1 commit into
open-telemetry:mainfrom
trask:avoid-reverse-name-lookup
Feb 8, 2022
Merged

Avoid potential for reverse name lookup#5305
trask merged 1 commit into
open-telemetry:mainfrom
trask:avoid-reverse-name-lookup

Conversation

@trask

@trask trask commented Feb 3, 2022

Copy link
Copy Markdown
Member

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

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

anuraaga commented Feb 3, 2022

Copy link
Copy Markdown
Contributor

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();

Copy link
Copy Markdown
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.

@laurit laurit left a comment

Copy link
Copy Markdown
Contributor

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

trask commented Feb 8, 2022

Copy link
Copy Markdown
Member Author

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