getsentry/sentry-ruby

Net::HTTP tracing doesn't support URIs with non ascii characters.

Closed this issue · 2 comments

Issue Description

When building traces for Net::HTTP sentry does not escape the string passed to URI.parse resulting in URI::InvalidURIError being raised if non-ascii characters are present in the path.

https://github.com/getsentry/sentry-ruby/blob/master/sentry-ruby/lib/sentry/net/http.rb#L69

Reproduction Steps

While using sentry, use Net::HTTP to send a request to a URI using non-ascii characters.

Sentry has no additional configuration:

Sentry.init do |sentry_config|
  sentry_config.dsn = config.fetch(:dsn)
end

Expected Behavior

When sentry tries to extract the request information, there should not be errors when the path contains non-ascii characters.

Actual Behavior

When sentry tries to extract the request information on Net::HTTP request traces, if the path contains non-ascii characters, the trace results in a URI::InvalidURIError.

Ruby Version

2.7, 3.x

SDK Version

5.19.0

Integration and Its Version

  • sentry-ruby
  • sentry-rails
  • sentry-delayed_job

Sentry Config

Sentry.init do |config|
  config.breadcrumbs_logger = [:active_support_logger, :http_logger, :sentry_logger]
  config.dsn = Rails.application.secrets.sentry_dsn
  config.enable_tracing = true
  config.excluded_exceptions += ['ActionController::RoutingError', 'ActiveRecord::RecordNotFound']
  config.delayed_job.report_after_job_retries = true
end

@rascencio-kraft can you also give me a sample non ascii string that this fails on?

@sl0thentr0py forgot to mention that there's a PR #2417 with a fix.

but an example could be:

"http://example.com/sømepath?q=få"