Skip to content

Correctly parse IPv6 addresses in Net::HTTP instrumentation #2180

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

Merged
merged 6 commits into from
Nov 25, 2023

Conversation

natikgadzhi
Copy link
Contributor

Summary

This pull request adds a Net::HTTP instrumentation fix for extract_request_info that makes it parse IPv6 addresses correctly.

Fixes #2163.

Thank you @Rotario for reporting and suggesting a fix!

Changes

  • Applied the workaround similar to what @Rotario suggested.
  • Added a unit test.
  • Added a changelog entry.

Copy link

codecov bot commented Nov 24, 2023

Codecov Report

Merging #2180 (28a6c85) into master (bebedc4) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2180      +/-   ##
==========================================
+ Coverage   97.28%   97.31%   +0.02%     
==========================================
  Files          99       99              
  Lines        3688     3690       +2     
==========================================
+ Hits         3588     3591       +3     
+ Misses        100       99       -1     
Components Coverage Δ
sentry-ruby 98.03% <100.00%> (+0.03%) ⬆️
sentry-rails 94.98% <ø> (ø)
sentry-sidekiq 94.50% <ø> (ø)
sentry-resque 92.06% <ø> (ø)
sentry-delayed_job 94.44% <ø> (ø)
sentry-opentelemetry 100.00% <ø> (ø)
Files Coverage Δ
sentry-ruby/lib/sentry/net/http.rb 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@natikgadzhi
Copy link
Contributor Author

Work in progress. Seems like older Rubies do not like Resolv. I think I'll just grab the regex and put it in our net/http.rb.

Copy link
Collaborator

@st0012 st0012 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it looks great 👍 I just have a nitpick on test.

@@ -1,6 +1,7 @@
# frozen_string_literal: true

require "net/http"
require "resolv"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add it to the net/http patch instead as it's required by it, not HTTPTransport.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/facepalm my bad, one sec

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@natikgadzhi
Copy link
Contributor Author

@st0012, cleaned things up!

  • Resolved the conflict
  • Explicit require "resolv"
  • Better scoped unit test (thank you!)

Let's see how CI gods feel about it.

@st0012 st0012 added the bug fix label Nov 25, 2023
@st0012 st0012 merged commit 168b43a into getsentry:master Nov 25, 2023
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.

IPv6 Literal notation isn't handled correctly when making XMLRPC requests
2 participants