-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(core): Only consider ingest endpoint requests when checking isSentryRequestUrl
#17393
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,12 @@ function checkTunnel(url: string, tunnel: string | undefined): boolean { | |
} | ||
|
||
function checkDsn(url: string, dsn: DsnComponents | undefined): boolean { | ||
return dsn ? url.includes(dsn.host) : false; | ||
// Requests to Sentry's ingest endpoint must have a `sentry_key` in the query string | ||
// This is equivalent to the public_key which is required in the DSN | ||
// see https://develop.sentry.dev/sdk/overview/#parsing-the-dsn | ||
// Therefore a request to the same host and with a `sentry_key` in the query string | ||
// can be considered a request to the ingest endpoint | ||
return dsn ? url.includes(dsn.host) && !!url.match(/sentry_key/) : false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Regex Overmatches Sentry Key in URLsThe regex There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yup, you're right. Will fix There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure if this is better, but we could also use |
||
} | ||
|
||
function removeTrailingSlash(str: string): string { | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
this perfectly illustrates the consequences of this change. Previously, this URL was considered a "Sentry request", now we have to add the query parameter for it to still be considered one. This is likely just because the test was "incomplete" before but it does open up potential for a few false negatives. Thoughts anyone?
We can further refine the URL matching logic as we want
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.
sounds reasonable to me!