Feature Request: Sanitize Auto-Tracked Resource URLs Before Reporting
Maintainers usually reply within 3 days
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- react-native, typescript
- Domain
- mobile
Research direction
Start by reading the automatic XHR resource tracking flow around resourceEventMapper and native startResource, then review the proposed branch and patch linked in the issue. Check how registerResourceEventMapper and unregisterResourceEventMapper affect already-enabled tracking. Done means rewritten URLs reach reported resources, null drops them before native tracking, and existing tracing and internal filters continue to work.
Written by the indexing model from the issue text.
Description
Feature description
Feature Description
Use case
We want to sanitize URLs of resources reported to Datadog from React Native apps to prevent
PII leaks through query parameters or other URL components.
For example, an auto-tracked resource URL like:
https://testurl.com?phone=12345
should be reported as:
https://testurl.com?phone=PHONE_PLACEHOLDER
This would let mobile apps apply the same resource URL sanitization strategy that our
frontend already supports, giving us consistent privacy controls across web and mobile
instrumentation.
How the SDK currently delivers this
The React Native SDK exposes resourceEventMapper, but the automatic XHR resource tracking
flow does not give it enough control before native RUM resource tracking starts.
In the current flow, URL-based filtering or sanitization can happen too late. The native
resource may already be started before the mapper has enough resource context to decide
whether the event should be kept, dropped, or sanitized.
This means applications cannot reliably use resourceEventMapper as the single place to
sanitize auto-tracked XHR resource URLs before they are reported to Datadog.
What we would like to see
We would like resourceEventMapper to be applied to auto-tracked XHR resources before native
startResource is called.
The mapper should receive resource URL context, for example through
resourceContext.responseURL, so applications can inspect and rewrite the URL before it is
reported.
Expected behavior:
- If
resourceEventMapperrewritesresourceContext.responseURL, the sanitized URL is used
for the reported RUM resource. - If
resourceEventMapperreturnsnull, the auto-tracked resource is dropped before native
tracking starts. - Runtime calls to
DdRum.registerResourceEventMapperand
DdRum.unregisterResourceEventMapperupdate the mapper used by already-enabled automatic
XHR tracking. - Existing resource tracking behavior, including tracing sample rate updates and internal SDK
resource filters, continues to work.
This would let React Native apps prevent PII leaks in Datadog resource URLs while keeping
behavior consistent with frontend instrumentation.
Proposed solution
Here is the suggested implementation:
Patch to test this out:
@datadog+mobile-react-native+3.5.1.patch
Other relevant information
No response
- Dominant language
- TypeScript
- Stars
- 145
- Forks
- 65
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 19
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataDog/dd-sdk-reactnative
-
[Babel plugin] A tracked component nested inside another tracked component is wrapped with the outer component's options/getContentPossibly taken @kevindice claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DataDog/dd-sdk-reactnative#1469 · 2 comments ·
Maintainers usually reply within 3 days
-
GraphQL variables with non-ASCII contents will make Apollo Client request throw errorPossibly taken @cdn34dd claimed this today. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
DataDog/dd-sdk-reactnative#1482 · 2 comments · 1 reaction · 1 assignee ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
DataDog/dd-sdk-reactnative#1377 · 1 comment · 1 reaction ·
Maintainers usually reply within 3 days
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 76/100
DataDog/dd-sdk-reactnative#1353 · 1 comment ·
Maintainers usually reply within 3 days
-
iOS: network error events from JS-tracked requests bypass the drop_resource deduplication and cannot be filtered — expose a native error mapper?Possibly taken A pull request linked to this issue is open or already merged. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
DataDog/dd-sdk-reactnative#1338 · 2 comments ·
Maintainers usually reply within 3 days
All issues in DataDog/dd-sdk-reactnative
Similar issues
-
Bump Firebase JS SDK (12.19.0 → 13.0.0)Possibly taken @SelaseKay claimed this today. OpenNeeds Attention type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
invertase/react-native-firebase#9364 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 4 days
-
e2e-failure ready-to-code
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
redhat-developer/rhdh-plugin-export-overlays#4261 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug] 官网文档的图片挂了Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
area:cli bug triage:in-progress
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day