-
Notifications
You must be signed in to change notification settings - Fork 241
Fix nil pointer dereference with malformed URLs when tracing enabled #1055
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
Conversation
- Ensure convert() always returns http.Request with valid URL field - Prevents panic in sentry.NewRequest() when transaction.Finish() is called - Affects both Fiber and FastHTTP integrations Fixes getsentry#1054
Can you please add a test case as well? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1055 +/- ##
=======================================
Coverage 86.87% 86.88%
=======================================
Files 55 55
Lines 5952 5956 +4
=======================================
+ Hits 5171 5175 +4
Misses 638 638
Partials 143 143 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Tests verify that malformed URLs don't cause panics when tracing is enabled, covering the fix for issue getsentry#1054.
Those should do it |
fasthttp/sentryfasthttp.go
Outdated
@@ -151,10 +151,11 @@ func convert(ctx *fasthttp.RequestCtx) *http.Request { | |||
|
|||
r.Method = string(ctx.Method()) | |||
|
|||
r.URL = &url.URL{Path: "/"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we somehow maintain a version with the raw URL instead of /
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use the uri.Path as a fallback here? @Peakz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies for the delay. I have now updated the solution to use uri.Path since it preserves the raw URL instead of the hardcoded /
. Thanks for the suggestion, @giortzisg!
@Peakz the fix was just released with v0.35.1. |
Fixes #1054