Skip to content

Commit

Permalink
Ignore broken regex for tracePropagationTarget (#2288)
Browse files Browse the repository at this point in the history
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Alexander Dinauer <adinauer@users.noreply.github.com>
Co-authored-by: Markus Hintersteiner <markus.hintersteiner@sentry.io>
Co-authored-by: Markus Hintersteiner <m.hintersteiner@gmail.com>
Co-authored-by: Roman Zavarnitsyn <rom4ek93@gmail.com>
Co-authored-by: getsentry-bot <bot@sentry.io>
Co-authored-by: getsentry-bot <bot@getsentry.com>
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
  • Loading branch information
8 people committed Oct 14, 2022
1 parent adee765 commit 4796772
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Expand Up @@ -2,14 +2,15 @@

## Unreleased

### Features

- Add captureProfile method to hub and client ([#2290](https://github.com/getsentry/sentry-java/pull/2290))

### Fixes

- Ensure potential callback exceptions are caught #2123 ([#2291](https://github.com/getsentry/sentry-java/pull/2291))
- Remove verbose FrameMetricsAggregator failure logging ([#2293](https://github.com/getsentry/sentry-java/pull/2293))
- Ignore broken regex for tracePropagationTarget ([#2288](https://github.com/getsentry/sentry-java/pull/2288))

### Features

- Add captureProfile method to hub and client ([#2290](https://github.com/getsentry/sentry-java/pull/2290))

## 6.5.0

Expand Down
9 changes: 8 additions & 1 deletion sentry/src/main/java/io/sentry/TracePropagationTargets.java
Expand Up @@ -15,9 +15,16 @@ public static boolean contain(final @NotNull List<String> origins, final @NotNul
return false;
}
for (final String origin : origins) {
if (url.contains(origin) || url.matches(origin)) {
if (url.contains(origin)) {
return true;
}
try {
if (url.matches(origin)) {
return true;
}
} catch (Exception e) {
// ignore invalid regex
}
}
return false;
}
Expand Down
5 changes: 5 additions & 0 deletions sentry/src/test/java/io/sentry/TracePropagationTargetsTest.kt
Expand Up @@ -26,4 +26,9 @@ class TracePropagationTargetsTest {
fun `when no origins are defined, returns false for every url`() {
assertFalse(TracePropagationTargets.contain(emptyList(), "http://some.api.com/"))
}

@Test
fun `ignores broken regex`() {
assertFalse(TracePropagationTargets.contain(listOf("AABB???"), "http://some.api.com/"))
}
}

0 comments on commit 4796772

Please sign in to comment.