Conversation

chargome

This PR adds support for auto-generated tunnel paths to avoid ad-blocker detection.

  • Random paths are less likely to be blocked than /monitoring
  • Users can just set tunnelRoute: true for an auto-generated route
  • Existing configs will still work

Note that every build will now create a different random path which should be quite unpredictable for ad-blockers

@chargomechargome self-assigned this Jun 17, 2025
@chargomechargome marked this pull request as draft June 17, 2025 22:38
Comment on lines +81 to +85
function generateRandomTunnelRoute(): string {
// Generate a random 8-character alphanumeric string
const randomString = Math.random().toString(36).substring(2, 10);
return `/${randomString}`;
}
Copy link
Member

Choose a reason for hiding this comment

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

Purely out of interestet, because I don't have context on how the SDK works in this case - how do we make sure these routes don't show up as endpoints in the data? Is this done by setUpTunnelRewriteRules?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have an event processor in place that will filter these out. That being said I still need to figure out some details regarding value injection and test this manually

Comment on lines +110 to +111
// Update the global options object to use the resolved value everywhere
userSentryOptions.tunnelRoute = resolvedTunnelRoute;
Copy link
Member

Choose a reason for hiding this comment

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

Hm, is this the only way to pass the route around? Not a big fan of overwriting the passed in option but maybe this is bike-shedding.

Copy link
Member Author

Choose a reason for hiding this comment

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

Seemed to be the most KISS variant I could think of here, because we can prevent the case that we have two different values floating around for the route

Copy link
Member

Choose a reason for hiding this comment

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

Yea, I guess fair enough.

@chargomechargome merged commit 57256ad into develop Jun 18, 2025
322 of 324 checks passed
@chargomechargome deleted the cg-next-randomize-tunnel branch June 18, 2025 14:36
Sign up for free to join this conversation on . Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.