-
-
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?
Conversation
size-limit report 📦
|
fetchData: { url: 'https://dsn.ingest.sentry.io/1337?sentry_key=123', method: 'POST' }, | ||
args: ['https://dsn.ingest.sentry.io/1337?sentry_key=123'], |
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!
This PR makes a change to our
isSentryRequestUrl
utility which is used in various parts of the SDKs.The function checks both, the DSN as well as the
tunnel
option to determine if a request URL is a URL to Sentry. I would argue, we should only returntrue
for requests to Sentry's ingest endpoint. For example, if users make regular requests to the Sentry API from within their app that uses a Sentry SDK, we should not special case that request.Therefore, this PR makes the check for the request URL more specific:
tunnel
is not provided, returntrue
iff the the url includes the host of the DSN AND if it includes thesentry_key
query param. This param is mandatory to be sent along, as it's equal to the public key of the DSN .tunnel
is provided, the check was already specific enough because the request URL has to match exactly the configured tunnel URL.While writing this, I realized there are still a bunch of edge cases here that we probably also should fix but for now, let's keep things atomic.
closes #17385
(^ very likely. We didn't repro this specifically but the
httpClientIntegration
bails out exactly if it hits theisSentryRequestUrl
check)