Skip to content

fix(core): Apply dataCollection.urlQueryParams to url.full and url.query - #23061

Open
chargome wants to merge 2 commits into
fix/filter-url-query-utilfrom
fix/gate-url-query-params-on-data-collection
Open

fix(core): Apply dataCollection.urlQueryParams to url.full and url.query#23061
chargome wants to merge 2 commits into
fix/filter-url-query-utilfrom
fix/gate-url-query-params-on-data-collection

Conversation

@chargome

@chargome chargome commented Aug 5, 2026

Copy link
Copy Markdown
Member

urlQueryParams only applied to request.query_string and requestDataIntegration. Everywhere else, query strings went to Sentry unfiltered — a ?token=… was sent as-is.

We filter spans in one central place (captureSpan) instead of at the ~57 write sites, which span ~18 packages and mostly have no access to the client. One place also means a new integration cannot leak by forgetting to filter.

Breadcrumbs do not go through the span pipeline, so those are filtered separately.

closes #23049

@chargome chargome self-assigned this Aug 5, 2026
@chargome

chargome commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

bugborzer run

Comment thread packages/core/test/lib/tracing/spans/captureSpan.test.ts
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 30.4 kB +0.92% +277 B 🔺
@sentry/browser - with treeshaking flags 28.59 kB +0.94% +264 B 🔺
@sentry/browser (incl. Tracing) 47.79 kB +0.53% +251 B 🔺
@sentry/browser (incl. Tracing + Span Streaming) 47.8 kB +0.53% +249 B 🔺
@sentry/browser (incl. Tracing, Profiling) 52.54 kB +0.48% +251 B 🔺
@sentry/browser (incl. Tracing, Replay) 87.18 kB +0.3% +258 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 76.58 kB +0.34% +253 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 91.85 kB +0.28% +249 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 104.51 kB +0.25% +258 B 🔺
@sentry/browser (incl. Feedback) 47.74 kB +0.61% +288 B 🔺
@sentry/browser (incl. sendFeedback) 35.23 kB +0.77% +266 B 🔺
@sentry/browser (incl. FeedbackAsync) 40.38 kB +0.69% +275 B 🔺
@sentry/browser (incl. Metrics) 31.45 kB +0.81% +250 B 🔺
@sentry/browser (incl. Logs) 31.69 kB +0.87% +271 B 🔺
@sentry/browser (incl. Metrics & Logs) 32.37 kB +0.8% +255 B 🔺
@sentry/react 32.16 kB +0.71% +226 B 🔺
@sentry/react (incl. Tracing) 50.05 kB +0.5% +248 B 🔺
@sentry/vue 35.49 kB +0.81% +285 B 🔺
@sentry/vue (incl. Tracing) 49.76 kB +0.49% +239 B 🔺
@sentry/svelte 30.42 kB +0.9% +271 B 🔺
CDN Bundle 32.4 kB +0.82% +263 B 🔺
CDN Bundle (incl. Tracing) 48.12 kB +0.63% +299 B 🔺
CDN Bundle (incl. Logs, Metrics) 33.93 kB +0.76% +254 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) 49.44 kB +0.52% +255 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) 73.32 kB +0.41% +297 B 🔺
CDN Bundle (incl. Tracing, Replay) 85.7 kB +0.29% +246 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.01 kB +0.27% +233 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 91.54 kB +0.3% +266 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.83 kB +0.26% +235 B 🔺
CDN Bundle - uncompressed 96 kB +0.73% +695 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 143.5 kB +0.49% +686 B 🔺
CDN Bundle (incl. Logs, Metrics) - uncompressed 100.63 kB +0.7% +695 B 🔺
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.47 kB +0.47% +686 B 🔺
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.32 kB +0.31% +695 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.75 kB +0.27% +686 B 🔺
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.72 kB +0.26% +686 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.46 kB +0.25% +686 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.41 kB +0.25% +686 B 🔺
@sentry/nextjs (client) 52.6 kB +0.44% +229 B 🔺
@sentry/sveltekit (client) 48.27 kB +0.57% +272 B 🔺
@sentry/core/server 65.81 kB +0.41% +264 B 🔺
@sentry/core/browser 52.05 kB +0.4% +207 B 🔺
@sentry/node 120.71 kB +0.21% +242 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 0 B added added
@sentry/node - without tracing 84.33 kB +0.25% +210 B 🔺
@sentry/aws-serverless 92.81 kB +0.22% +195 B 🔺
@sentry/cloudflare (withSentry) - minified 219.09 kB +0.26% +551 B 🔺
@sentry/cloudflare (withSentry) 540.37 kB +0.32% +1.67 kB 🔺

View base workflow run

@chargome

chargome commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

bugbot 📿

@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.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit b82b19e. Configure here.

chargome and others added 2 commits August 5, 2026 16:42
…rl.query`

`urlQueryParams` only applied to `request.query_string` and
`requestDataIntegration`. Everywhere else, query strings went to Sentry
unfiltered.

Spans are filtered in one central place (`captureSpan`) instead of at the ~57
write sites, which span ~18 packages and mostly have no access to the client.
The pass runs after the `processSpan` hooks so integration-set attributes are
covered, and before `beforeSendSpan` since explicitly user-attached data is not
gated by `dataCollection`.

Breadcrumbs do not go through the span pipeline, so those are filtered
separately at write time.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Breadcrumb query filtering had no test coverage, so re-leaking a token would not
have failed CI. Adds cases for the default denylist, off mode, allowList and
extra deny terms on both outgoing request breadcrumb paths. The node fetch path
needs its own file because the existing test module mocks `getClient` without
`getDataCollectionOptions`.

Also fixes two span tests that claimed more than they asserted: one checks the
span name is untouched but never looked at it, and the other claimed to cover
attributes set after the span starts while passing them in at creation. The
latter now registers a `processSpan` subscriber, mirroring how
`requestDataIntegration` sets `url.full`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@chargome
chargome force-pushed the fix/gate-url-query-params-on-data-collection branch from b82b19e to 0e39522 Compare August 5, 2026 14:42
@chargome
chargome marked this pull request as ready for review August 5, 2026 15:02
@chargome
chargome requested a review from a team as a code owner August 5, 2026 15:02
@chargome
chargome requested review from andreiborza, msonnb, nicohrubec and stephanie-anderson and removed request for a team and stephanie-anderson August 5, 2026 15:02
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.

Audit URL data collection against the dataCollection spec (urlQueryParams)

1 participant