Skip to content

fix(browser): Apply urlQueryParams to event URLs, static span names and LCP URLs - #25262

Merged
JPeer264 merged 3 commits into
developfrom
jp/browser-sensitive-query-params-transactions
Oct 12, 2026
Merged

JPeer264 merged 3 commits into
developfrom
jp/browser-sensitive-query-params-transactions

Conversation

@JPeer264

Copy link
Copy Markdown
Member

closes #25247
closes JS-3907

Description

This applies dataCollection.urlQueryParams to the URLs that the browser SDK still sent unfiltered: the page URL in event.request.url, the browser.* and resource.* span names in the static trace lifecycle, and the LCP URL attributes (lcp.url, browser.web_vital.lcp.url). event.request.url leaked on error events with every trace lifecycle, the span names only with traceLifecycle: 'static' (the v10 default).

Most of the added lines are tests.

Sentry traces

Before (11.6.0), jwt=sensitive-jwt-value in request.url and span names: https://sentry-sdks.sentry.io/explore/traces/trace/056ddfee720849c78e4e0b68f9da8c5b/?project=4510555608449024&timestamp=1791796663
After (this PR), jwt=[Filtered]: https://sentry-sdks.sentry.io/explore/traces/trace/ea9fd2cc90de4343bf5bfb6eb0d923ad/?project=4510555608449024&timestamp=1791796677

… and LCP URLs

`dataCollection.urlQueryParams` only filtered `url.full` and `url.query`. The
page URL in `event.request.url`, the static `browser.*` and `resource.*` span
names, and the LCP URL attributes still sent sensitive values such as
`?jwt=...` to Sentry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Oct 12, 2026

Copy link
Copy Markdown

JS-3907

@JPeer264

Copy link
Copy Markdown
Member Author

bugbot run

@JPeer264 JPeer264 self-assigned this Oct 12, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 68306da. Configure here.


startAndEndSpan(span, responseStartTimestamp, responseEndTimestamp, {
name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[BROWSER_RESPONSE] : entry.name,
name: spanStreamingEnabled ? BROWSER_NAVIGATION_TIMING_SPAN_NAMES[BROWSER_RESPONSE] : url,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Query filter ignores owning client

Low Severity

This is a check on whether getClient() is necessary, not a hard rule break. filterCollectedUrl runs for navigation and resource span URLs and for static lcp.url without the tracing client. It then reads urlQueryParams from getClient(), which can be missing or a different client, so that client's dataCollection.urlQueryParams policy is not applied.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 68306da. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@msonnb @logaretm wondering it this would be an issue on the browser

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

technically yes if the client changes between span start and completion i guess. but pre-existing (here and elsewhere), so not a blocker imo

@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 29.82 kB +0.02% +4 B 🔺
@sentry/browser - with treeshaking flags 27.95 kB +0.02% +5 B 🔺
@sentry/browser - with treeshaking flags tracing without tracing 27.86 kB +0.02% +4 B 🔺
@sentry/browser (incl. Tracing) 51.92 kB +0.08% +41 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 51.94 kB +0.09% +42 B 🔺
@sentry/browser (incl. Tracing, Profiling) 54.87 kB +0.08% +41 B 🔺
@sentry/browser (incl. Tracing, Replay) 91.67 kB +0.05% +42 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 80.53 kB +0.06% +41 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 96.39 kB +0.06% +50 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 109.36 kB +0.04% +38 B 🔺
@sentry/browser (incl. Feedback) 47.35 kB +0.01% +4 B 🔺
@sentry/browser (incl. sendFeedback) 34.87 kB +0.01% +3 B 🔺
@sentry/browser (incl. FeedbackAsync) 39.98 kB +0.01% +2 B 🔺
@sentry/browser (incl. Metrics) 30.85 kB +0.02% +5 B 🔺
@sentry/browser (incl. Logs) 31.13 kB +0.02% +5 B 🔺
@sentry/browser (incl. Metrics & Logs) 31.77 kB +0.02% +5 B 🔺
@sentry/react 31.65 kB +0.02% +5 B 🔺
@sentry/react (incl. Tracing) 54.26 kB +0.09% +45 B 🔺
@sentry/vue 37.89 kB +0.02% +5 B 🔺
@sentry/vue (incl. Tracing) 54.85 kB +0.08% +42 B 🔺
@sentry/svelte 29.85 kB +0.02% +5 B 🔺
@sentry/remix (Remix 3 client bundle) 56.94 kB +0.06% +32 B 🔺
CDN Bundle 31.55 kB +0.01% +3 B 🔺
CDN Bundle (incl. Tracing) 52.44 kB +0.06% +31 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.75 kB +0.02% +4 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 54.38 kB +0.07% +34 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 74.68 kB +0.01% +5 B 🔺
CDN Bundle (incl. Tracing, Replay) 90.1 kB +0.05% +37 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 92.03 kB +0.04% +35 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 96.26 kB +0.04% +32 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 98.22 kB +0.04% +32 B 🔺
CDN Bundle - uncompressed 92.92 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 155.58 kB +0.04% +52 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 99.45 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 161.53 kB +0.04% +52 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 229.49 kB +0.01% +6 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 275.75 kB +0.02% +52 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 281.69 kB +0.02% +52 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 289.45 kB +0.02% +52 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 295.38 kB +0.02% +52 B 🔺
@sentry/nextjs (client) 56.66 kB +0.08% +44 B 🔺
@sentry/sveltekit (client) 52.31 kB +0.09% +45 B 🔺
@sentry/core/server 40.92 kB - -
@sentry/core/browser 13.74 kB - -
@sentry/node 151.89 kB +0.01% +12 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 83.77 kB - -
@sentry/node - without tracing 94.45 kB +0.01% +6 B 🔺
@sentry/node - without channel injection 130.09 kB +0.01% +8 B 🔺
@sentry/aws-serverless 102.62 kB +0.01% +4 B 🔺
@sentry/cloudflare (withSentry) - minified 210.2 kB - -
@sentry/cloudflare (withSentry) 521.15 kB - -
@sentry/nextjs/cloudflare (withSentry) - minified 227.87 kB - -

View base workflow run

@JPeer264
JPeer264 marked this pull request as ready for review October 12, 2026 11:56
@JPeer264
JPeer264 requested review from a team as code owners October 12, 2026 11:56
@JPeer264
JPeer264 requested review from logaretm, msonnb, nicohrubec and s1gr1d and removed request for a team October 12, 2026 11:56
return;
}
const op = NAVIGATION_TIMING_SPAN_OPS[event];
const url = filterCollectedUrl(entry.name);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: can we rename this to filteredUrl?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yup good idea. I changed it

@JPeer264
JPeer264 added this pull request to stack #25291 October 12, 2026 13:36
@JPeer264
JPeer264 merged commit ee04661 into develop Oct 12, 2026
717 of 721 checks passed
@JPeer264
JPeer264 deleted the jp/browser-sensitive-query-params-transactions branch October 12, 2026 14:18
JPeer264 added a commit that referenced this pull request Oct 12, 2026
… URLs (#25289)

follow up to #25262

This applies `dataCollection.urlQueryParams` to the URLs in the fetch,
XHR and navigation breadcrumbs and to the `ui.element.url` attribute of
`elementTimingIntegration`. These still sent sensitive query values such
as `?jwt=...` to Sentry.

## Sentry events

Before (11.6.0), `jwt=sensitive-jwt-value` in the breadcrumbs:
https://sentry-sdks.sentry.io/issues/7787761489/events/2bfc6630501c4314bf84b884a4afb1e9/
After (this PR), `jwt=[Filtered]`:
https://sentry-sdks.sentry.io/issues/7787761463/events/6ae067a147b84e6eb33553ae7ce217c7/

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

Sensitive URL query params leak to Sentry in transaction events

3 participants