Skip to content

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

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

Closed
rascencio-kraft opened this issue Sep 27, 2024 · 2 comments · Fixed by #2417
Closed

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

rascencio-kraft opened this issue Sep 27, 2024 · 2 comments · Fixed by #2417
Assignees

Comments

@rascencio-kraft
Copy link
Contributor

rascencio-kraft commented Sep 27, 2024

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
@sl0thentr0py
Copy link
Member

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

@rascencio-kraft
Copy link
Contributor Author

@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å"

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