GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — The best way to scrub params in url path · getsentry/sentry-javascript · Discussion #15633

The best way to scrub params in url path #15633

Gordienko-RU started this conversation in General
The best way to scrub params in url path #15633
@Gordienko-RU Gordienko-RU
Mar 11, 2025 · 1 comment
Return to top
Discussion options
  • Uh oh!

    There was an error while loading. Please reload this page.

Gordienko-RU
Mar 11, 2025

Hello.

We have React application(with react-router and react-query) which consists of several microfrontends and does a lot of requests to different services.

The requirement is - error report should contain no client sensitive information and a lot of requests which app currently does contain that info in url path params.

For examle /users/12134/orders/2345 - should be transformed to smth like - /users/:userId/orders/:orderId.

Currently have two ideas:

  1. Solid, but will require a lot of work - create a collection of all possible url route masks which we are using on FE side.

Sort of:

const apiMasks = [
/users/:userId/orders/:orderId
]

Having that info, I can find a match between url string and such pattern and understand where params are placed, to finaly make some nice substitution like react-router actually does for transaction value.

Then I define beforeSendTransaction / beforeSend / beforeBreadcrumb / beforeSendSpan - to find all possible url injections within event data and update them.

  1. If we assume that all sensitive params are represented as a number strings - there is no need to have any api structure info, we can just split url into tokens and substitute all numeral strings with generic text, like ':param'.

This way is much simpler, but is based on assumptions and output urls are not so nice.

Tbh I don't think there are some nice solutions here, cause we need to know information about api to make some nice polishing from FE side, but maybe there is already libs or approaches implemented by community?

You must be logged in to vote
All reactions

Replies: 1 comment

Comment options
  • Uh oh!

    There was an error while loading. Please reload this page.

AbhiPrasad
Mar 21, 2025

@Gordienko-RU that seems to be the most foolproof way of accomplishing this. The SDK has no way of knowing your application's routing structure otherwise.

You must be logged in to vote
All reactions
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
💬
General
Labels
None yet
2 participants
@Gordienko-RU @AbhiPrasad
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.