Skip to content

RUM-16634: Add wildcard host pattern matching to WebViewTracking#3540

Draft
kikoveiga wants to merge 1 commit into
developfrom
kikoveiga/rum-16634/webview-host-patterns
Draft

RUM-16634: Add wildcard host pattern matching to WebViewTracking#3540
kikoveiga wants to merge 1 commit into
developfrom
kikoveiga/rum-16634/webview-host-patterns

Conversation

@kikoveiga

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Adds a new WebViewTracking.enableWithPatterns API 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 existing getAllowedWebViewHosts() bridge.
  • Adds a HostPatternValidator to dd-sdk-android-core which handles validating and normalizing wildcard patterns. It lives in the core so 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)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@kikoveiga kikoveiga requested review from a team as code owners June 12, 2026 16:15
@datadog-datadog-prod-us1-2

This comment has been minimized.

@kikoveiga kikoveiga marked this pull request as draft June 12, 2026 16:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.67442% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 72.17%. Comparing base (e0d2f78) to head (3030c6a).
⚠️ Report is 25 commits behind head on develop.

Files with missing lines Patch % Lines
...lin/com/datadog/android/webview/WebViewTracking.kt 95.00% 1 Missing ⚠️
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     
Files with missing lines Coverage Δ
...android/core/configuration/HostPatternValidator.kt 100.00% <100.00%> (ø)
...dog/android/webview/internal/DatadogEventBridge.kt 100.00% <100.00%> (ø)
...lin/com/datadog/android/webview/WebViewTracking.kt 85.82% <95.00%> (+1.39%) ⬆️

... and 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants