getsentry / team-sdks

A meta repository for tracking work across all SDK teams.
0 stars 0 forks source link

Project: Filter emails in URLs correctly #39

Open kahest opened 8 months ago

kahest commented 8 months ago

Description

URLs sent to Sentry should have authority filtered correctly. While this is implemented already, filtering of emails from other parts of the URL is not desired. This has come up in the following issues: https://github.com/getsentry/sentry-java/issues/2690 https://github.com/getsentry/sentry-dart/issues/1418

The goal of this issue is to ensure that all our SDKs

  1. filter authority correctly
  2. don't filter email from other parts of the URL

Examples: (for more see e.g. https://github.com/getsentry/sentry-dart/blob/8a10ab719072f65d029985c211471d779ab2a3cb/dart/test/utils/http_sanitizer_test.dart#L9)

Input Expected
https://dev.sentry.io/api/v4/reset/email@example.com https://dev.sentry.io/api/v4/reset/email@example.com
https://user:password@sentry.io?q=1&s=2&token=secret https://[Filtered]:[Filtered]@sentry.io
### Tasks
- [ ] https://github.com/getsentry/sentry-cocoa/issues/3417
- [ ] https://github.com/getsentry/sentry-java/issues/2690
- [x] React Native
- [ ] https://github.com/getsentry/sentry-dart/issues/1418
krystofwoldrich commented 7 months ago

React Native uses sanitization logic from JS which passes the test correctly https://github.com/getsentry/sentry-javascript/blob/08308664394fb9eabda9f334f4cf97048fa0a4d9/packages/utils/test/url.test.ts#L72

https://github.com/getsentry/sentry-javascript/blob/08308664394fb9eabda9f334f4cf97048fa0a4d9/packages/node/test/integrations/http.test.ts#L321

kahest commented 7 months ago

React Native uses sanitization logic from JS which passes the test correctly getsentry/sentry-javascript@0830866/packages/utils/test/url.test.ts#L72

getsentry/sentry-javascript@0830866/packages/node/test/integrations/http.test.ts#L321

Thanks for checking! I don't see a test for the first case though - with email outside of the authority part, e.g. https://dev.sentry.io/api/v4/reset/email@example.com -> https://dev.sentry.io/api/v4/reset/email@example.com