Skip to content

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Aug 12, 2025

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 return true 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:

  • If tunnel is not provided, return true iff the the url includes the host of the DSN AND if it includes the sentry_key query param. This param is mandatory to be sent along, as it's equal to the public key of the DSN .
  • If 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 the isSentryRequestUrl check)

cursor[bot]

This comment was marked as outdated.

Copy link
Contributor

github-actions bot commented Aug 12, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.16 kB added added
@sentry/browser - with treeshaking flags 22.73 kB added added
@sentry/browser (incl. Tracing) 39.87 kB added added
@sentry/browser (incl. Tracing, Replay) 78.01 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 67.84 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 82.7 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 94.81 kB added added
@sentry/browser (incl. Feedback) 40.83 kB added added
@sentry/browser (incl. sendFeedback) 28.81 kB added added
@sentry/browser (incl. FeedbackAsync) 33.7 kB added added
@sentry/react 25.88 kB added added
@sentry/react (incl. Tracing) 41.86 kB added added
@sentry/vue 28.64 kB added added
@sentry/vue (incl. Tracing) 41.69 kB added added
@sentry/svelte 24.18 kB added added
CDN Bundle 25.66 kB added added
CDN Bundle (incl. Tracing) 39.76 kB added added
CDN Bundle (incl. Tracing, Replay) 75.83 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 81.28 kB added added
CDN Bundle - uncompressed 74.96 kB added added
CDN Bundle (incl. Tracing) - uncompressed 117.59 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 231.9 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 244.5 kB added added
@sentry/nextjs (client) 43.89 kB added added
@sentry/sveltekit (client) 40.32 kB added added
@sentry/node-core 47.99 kB added added
@sentry/node 147.02 kB added added
@sentry/node - without tracing 92.24 kB added added
@sentry/aws-serverless 103.67 kB added added

@Lms24 Lms24 requested review from mydea and andreiborza August 12, 2025 14:34
@Lms24 Lms24 self-assigned this Aug 12, 2025
Comment on lines +104 to +105
fetchData: { url: 'https://dsn.ingest.sentry.io/1337?sentry_key=123', method: 'POST' },
args: ['https://dsn.ingest.sentry.io/1337?sentry_key=123'],
Copy link
Member Author

@Lms24 Lms24 Aug 12, 2025

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds reasonable to me!

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

Successfully merging this pull request may close these issues.

Http client errors not sent when relay is hosted on the same domain.
2 participants