From 9a4f6f58e3467eb115ec6d612aab11f1c3f41eb1 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Mon, 12 Oct 2026 14:24:23 +0000 Subject: [PATCH] fix(v10/browser): Apply `urlQueryParams` to event URLs, static span names and LCP URLs Backport of: #25262 --- .../suites/integrations/httpContext/test.ts | 14 ++- .../init.js | 10 ++ .../template.html | 9 ++ .../test.ts | 33 ++++++ .../metrics/web-vitals-lcp/template.html | 2 +- .../tracing/metrics/web-vitals-lcp/test.ts | 5 +- .../utils/fixtures.ts | 2 +- .../src/metrics/browserMetrics.ts | 15 ++- packages/browser-utils/src/metrics/lcp.ts | 3 +- .../src/metrics/webVitalSpans.ts | 3 +- .../test/browser/browserMetrics.test.ts | 111 ++++++++++++------ .../browser-utils/test/metrics/lcp.test.ts | 4 +- .../test/metrics/webVitalSpans.test.ts | 4 +- .../browser/src/integrations/httpcontext.ts | 3 +- .../src/tracing/browserTracingIntegration.ts | 5 +- .../test/integrations/httpcontext.test.ts | 25 +++- .../pagesRouterInstrumentation.test.ts | 1 + 17 files changed, 191 insertions(+), 58 deletions(-) create mode 100644 dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/init.js create mode 100644 dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/template.html create mode 100644 dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/test.ts diff --git a/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts b/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts index dd8a870a3bad..b4837ecbb687 100644 --- a/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts +++ b/dev-packages/browser-integration-tests/suites/integrations/httpContext/test.ts @@ -1,7 +1,7 @@ import { expect } from '@playwright/test'; import type { Event } from '@sentry/core'; import { sentryTest } from '../../../utils/fixtures'; -import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers'; +import { envelopeRequestParser, getFirstSentryEnvelopeRequest, waitForErrorRequest } from '../../../utils/helpers'; sentryTest('httpContextIntegration captures user-agent and referrer', async ({ getLocalTestUrl, page }) => { const url = await getLocalTestUrl({ testDir: __dirname }); @@ -23,3 +23,15 @@ sentryTest('httpContextIntegration captures user-agent and referrer', async ({ g url: expect.any(String), }); }); + +sentryTest('httpContextIntegration filters sensitive query params in the URL', async ({ getLocalTestUrl, page }) => { + const url = await getLocalTestUrl({ testDir: __dirname }); + + const errorEventPromise = waitForErrorRequest(page); + + await page.goto(`${url}?jwt=sensitive-jwt-value&page=1`); + + const errorEvent = envelopeRequestParser(await errorEventPromise); + + expect(errorEvent.request?.url).toBe(`${url}?jwt=[Filtered]&page=1`); +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/init.js b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/init.js new file mode 100644 index 000000000000..bb6d4918d1bf --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/init.js @@ -0,0 +1,10 @@ +import * as Sentry from '@sentry/browser'; + +window.Sentry = Sentry; + +Sentry.init({ + traceLifecycle: 'static', + dsn: 'https://public@dsn.ingest.sentry.io/1337', + integrations: [Sentry.browserTracingIntegration()], + tracesSampleRate: 1, +}); diff --git a/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/template.html b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/template.html new file mode 100644 index 000000000000..3d3b49a9951f --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/tracing/browserTracingIntegration/pageload-sensitive-query-params-static/template.html @@ -0,0 +1,9 @@ + + +
+ + + +
+