Skip to content

Route Ask AI widget tickets through Help WebView log-attach flow#5330

Open
joashrajin wants to merge 1 commit into
mainfrom
feat/help-webview-chatbot-support-recipient
Open

Route Ask AI widget tickets through Help WebView log-attach flow#5330
joashrajin wants to merge 1 commit into
mainfrom
feat/help-webview-chatbot-support-recipient

Conversation

@joashrajin
Copy link
Copy Markdown
Contributor

Summary

The Ask AI widget on the in-app help WebView is moving to a new dedicated support recipient so widget-originated tickets bypass the AI auto-reply loop.

Full context, motivation, and test plan: PCDROID-557.

Today, when a user taps the widget's "contact us here" link inside the in-app Help WebView, HelpWebViewClient intercepts the mailto: and routes it through Support.shareLogs(), which builds an Intent.ACTION_SEND with debug.txt attached. The recipient list and outgoing address are hardcoded — so once the widget renders the new recipient, the WebView would stop recognising the link, fall through to onTapUri(), and the user would email the new inbox without debug logs attached.

This PR makes the recipient address configurable end-to-end while preserving existing behaviour for every other caller of shareLogs().

Changes

  • HelpPage.kt — replaced the prefix-match allowlist with an exact-recipient Set<String> (supportRecipients) that now includes the new AI-assistant recipient. Parses the recipient from the matched mailto URL and passes it through. Falls back to onTapUri() for any mailto whose recipient isn't in the set. The WebViewError "Contact support" button (shown when the help page fails to load) explicitly uses the existing support recipient.
  • HelpViewModel.getSupportIntent() — accepts an optional recipient: String (default: existing support recipient) and forwards it.
  • Support.shareLogs() — adds an optional recipient: String parameter (default: existing support recipient) and uses it for Intent.EXTRA_EMAIL instead of the hardcoded address. Other callers (LogsViewModel, StatusViewModel, the getFeedbackIntent path, and emailWearLogsToSupportIntent) are unaffected via the default.

Security note

The previous contactSupportAction.any { url.startsWith(it) } check matched by prefix, so a mailto: whose recipient was crafted as <allowlisted>@example.com.attacker.com would also match. This was harmless before because the to-address was hardcoded — but parsing the recipient from the URL would have made it exploitable. This PR tightens to exact-equality matching against the supportRecipients set.

Test plan

Full test plan in PCDROID-557. Highlights:

  • Ask AI widget → "contact us here" link → email composer opens with the new recipient and debug.txt attached.
  • Regular "Contact support" button on the Help page still uses the existing recipient and debug.txt (regression).
  • Standalone Logs share flow still uses the existing recipient (regression).
  • WebViewError "Contact support" button (airplane mode → help page fails) still uses the existing recipient (regression).
  • A mailto: whose recipient isn't in supportRecipients falls through to the system email composer with no log attachment, no crash.

Coordination

Draft until the widget HTML swap is timed.

iOS counterpart: Automattic/pocket-casts-ios#4227.

The Ask AI widget on the in-app help WebView is moving to a new
dedicated support recipient so widget-originated tickets bypass the
AI auto-reply loop. Without this change, the WebView client at
HelpPage.kt does not recognize the new recipient and the mailto
falls through to the system email composer with no debug.txt
attached.

Linear: PCDROID-557

- Replace HelpPage.kt's prefix-match allowlist with an exact-equality
  Set<String> of recognized recipients
- Tighten mailto matching from prefix-startsWith (which would also
  match crafted lookalike domains) to exact equality
- Thread the parsed recipient through HelpWebViewClient ->
  HelpViewModel.getSupportIntent -> Support.shareLogs so the intent's
  EXTRA_EMAIL reflects the URL the user tapped
- Other shareLogs callers (LogsViewModel, StatusViewModel, the
  feedback intent, the wear-logs intent) continue to default to the
  existing support recipient via parameter defaults
@joashrajin joashrajin requested a review from a team as a code owner May 22, 2026 05:26
@joashrajin joashrajin requested review from Copilot and geekygecko and removed request for a team and Copilot May 22, 2026 05:26
@dangermattic
Copy link
Copy Markdown
Collaborator

dangermattic commented May 22, 2026

1 Warning
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants