feat(core)!: Make tracePropagationTargets matching case-insensitive - #23534
Open
chargome wants to merge 9 commits into
Open
feat(core)!: Make tracePropagationTargets matching case-insensitive#23534chargome wants to merge 9 commits into
tracePropagationTargets matching case-insensitive#23534chargome wants to merge 9 commits into
Conversation
String and regex entries in `tracePropagationTargets` now match the outgoing request URL regardless of casing. Previously the casing had to match exactly. In browsers the URL is normalized with `new URL()` first, which lower-cases the origin, so `'myApi.com'` or `/^myApi\.com/` could never match a request to `https://myApi.com`. Keep this to a dedicated matcher in core instead of changing `isMatchingPattern`, which also backs `ignoreErrors`, `denyUrls` and `ignoreTransactions`. Also drop the `g`/`y` flags on target regexes, which make `test()` stateful, so `/myApi\.com/g` previously matched only every other request. Fixes #16018 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Note the new behaviour in the `tracePropagationTargets` JSDoc that users see in their editor, and scope the migration guide example to browsers. Server SDKs match against the raw URL, so a target matching the request's casing did work there in v10. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
size-limit report 📦
|
…s` tests CodeQL's js/incomplete-hostname-regexp flagged 16 new high-severity alerts on the test fixtures added in this branch: patterns like `/^https:\/\/myapi\.com/` and `'myapi.com'` also match `https://myapi.com.evil.com`. The rule is right to flag these. `tracePropagationTargets` decides which outgoing requests receive `sentry-trace` and `baggage` headers, so an unterminated target leaks trace context to unintended hosts, and these fixtures are what users copy. Terminate the host portion of each fixture. The assertions cover casing, not anchoring, so this does not weaken them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The `g`-flag regression test still used a pattern with no leading anchor, which CodeQL flagged because arbitrary hosts can precede it. Anchoring it keeps the test's purpose intact: with `g` preserved the anchored pattern still fails the second call, because `test()` resumes from `lastIndex` where `^` can no longer match. Verified by reverting the flag-stripping, which fails this test alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ake-tracepropagationtargets-matching-case-insensitive
…gets-matching-case-insensitive
Member
Author
|
bughansl run |
There was a problem hiding this comment.
✅ 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 e768fb2. Configure here.
…lifecycle The new suites were copied from neighbouring ones that pin `traceLifecycle: 'static'`, so they covered the non-default path. Span streaming is the default in v11, which is what these should exercise. The node envelope assertion moves from `transaction` to `span`, since streaming emits span v2 items rather than transaction events. Both suites were re-confirmed to fail without the fix under streaming. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…case-insensitive' of https://github.com/getsentry/sentry-javascript into charlygomez/js-4-make-tracepropagationtargets-matching-case-insensitive
…gets-matching-case-insensitive
chargome
marked this pull request as ready for review
August 25, 2026 08:37
chargome
requested review from
JPeer264,
andreiborza,
isaacs,
logaretm,
msonnb and
nicohrubec
and removed request for
a team
August 25, 2026 08:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
String and regex entries in
tracePropagationTargetsnow match the outgoing request URL regardless of casing.Previously the casing had to match exactly. In browsers the URL is normalized with
new URL()first, which lower cases the origin — so'myApi.com'or/^myApi\.com/could never match a request tohttps://myApi.com.Kept to a dedicated matcher in core instead of changing
isMatchingPattern, which also backsignoreErrors,denyUrlsandignoreTransactions.Also drops the
g/yflags on target regexes — they maketest()stateful, so/myApi\.com/gpreviously matched only every other request.Fixes #16018