RUM-16634: Add wildcard host pattern matching to WebViewTracking#3540
RUM-16634: Add wildcard host pattern matching to WebViewTracking#3540kikoveiga wants to merge 1 commit into
WebViewTracking#3540Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3030c6a1ba
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ) | ||
| null | ||
| } | ||
| else -> lowercased |
There was a problem hiding this comment.
Reject non-host plain patterns before forwarding
Because the validator only checks the character set and wildcard count, plain entries such as "com", "net", or malformed labels are accepted here and returned by enableWithPatterns. The new WebViewTracking docs say plain patterns match exactly or as a subdomain suffix like enable, but HostsSanitizer rejects top-level-only hosts; accepting "com" would allow tracking for every .com WebView page instead of dropping the bad configuration.
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3540 +/- ##
===========================================
- Coverage 72.18% 72.17% -0.01%
===========================================
Files 965 966 +1
Lines 35635 35675 +40
Branches 5947 5950 +3
===========================================
+ Hits 25721 25747 +26
- Misses 8296 8304 +8
- Partials 1618 1624 +6
🚀 New features to boost your workflow:
|
What does this PR do?
WebViewTracking.enableWithPatternsAPI that accepts wildcard host patterns (e.g.,"*.example.com,"preview-*.shopist.io") in addition to plain hosts. Patterns are validated on our side and then transmitted to the Browser SDK through the existinggetAllowedWebViewHosts()bridge.HostPatternValidatortodd-sdk-android-corewhich handles validating and normalizing wildcard patterns. It lives in thecoreso the incoming first-party-hosts widlcard matching work can reuse it.Motivation
Customers weren't able to easily enumerate hostnames loaded in a WebView such as ephemeral preview URLs, multi-tenant subdomains.
Additional Notes
iOS PR: DataDog/dd-sdk-ios#2963
Broswer PR: DataDog/browser-sdk#4703
Review checklist (to be filled by reviewers)