RUM-16634: Add wildcard host pattern matching to WebViewTracking#3540
Conversation
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".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3540 +/- ##
===========================================
- Coverage 72.80% 72.77% -0.03%
===========================================
Files 974 975 +1
Lines 35228 35268 +40
Branches 5965 5974 +9
===========================================
+ Hits 25645 25663 +18
- Misses 7915 7929 +14
- Partials 1668 1676 +8
🚀 New features to boost your workflow:
|
363dc08 to
ec19467
Compare
8300e91 to
4a8878d
Compare
There was a problem hiding this comment.
Pull request overview
Extends the WebView tracking configuration to support wildcard host patterns (e.g. *.example.com, preview-*.shopist.io) and validates/normalizes these patterns before passing them to the Browser SDK via the JS bridge. Introduces a reusable HostPatternValidator in dd-sdk-android-core to centralize wildcard-pattern validation logic.
Changes:
- Add
HostPatternValidator(core) + unit tests, and update core API surface files accordingly. - Update
DatadogEventBridge.getAllowedWebViewHosts()to sanitize plain hosts and validate wildcard patterns separately. - Add/adjust WebView module unit tests and detekt safe-call allowlist entries needed by the new implementation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| features/dd-sdk-android-webview/src/test/kotlin/com/datadog/android/webview/WebViewTrackingTest.kt | Adds coverage ensuring wildcard patterns are passed through the bridge correctly. |
| features/dd-sdk-android-webview/src/test/kotlin/com/datadog/android/webview/internal/DatadogEventBridgeTest.kt | Adds coverage for mixed plain hosts + wildcard patterns, invalid patterns, and edge cases. |
| features/dd-sdk-android-webview/src/main/kotlin/com/datadog/android/webview/WebViewTracking.kt | Updates public API KDoc and wires an InternalLogger into the bridge. |
| features/dd-sdk-android-webview/src/main/kotlin/com/datadog/android/webview/internal/DatadogEventBridge.kt | Implements wildcard-vs-plain host splitting and validation prior to JSON serialization. |
| detekt_custom_safe_calls.yml | Allows new Kotlin/OkHttp calls used by the validator/bridge. |
| dd-sdk-android-core/src/test/kotlin/com/datadog/android/core/configuration/HostPatternValidatorTest.kt | Adds unit tests for wildcard validation rules and logging behavior. |
| dd-sdk-android-core/src/main/kotlin/com/datadog/android/core/configuration/HostPatternValidator.kt | Introduces reusable wildcard host-pattern validation/normalization. |
| dd-sdk-android-core/api/dd-sdk-android-core.api | Updates API dump to include HostPatternValidator. |
| dd-sdk-android-core/api/apiSurface | Updates API surface snapshot to include HostPatternValidator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
4a8878d to
37d0497
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 37d0497a16
ℹ️ 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".
37d0497 to
47ee896
Compare
d1c0991 to
d91107c
Compare
satween
left a comment
There was a problem hiding this comment.
All good except question http -> htts transformation 👍
d91107c to
a43c1a3
Compare
What does this PR do?
WebViewTracking.enableAPI so thatallowedHostsentries may be 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 thegetAllowedWebViewHosts()bridge.HostPatternSanitizertodd-sdk-android-corewhich handles validating and normalizing wildcard patterns. It lives in thecoreso the incoming first-party-hosts wildcard 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)