Skip to content

security(tabapay): validate postMessage origin in WebView listener#2290

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/application-security-review-905b
Draft

security(tabapay): validate postMessage origin in WebView listener#2290
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/application-security-review-905b

Conversation

@cursor

@cursor cursor Bot commented Jun 18, 2026

Copy link
Copy Markdown

Vulnerability summary

The TabaPay Connect WebView installed an unrestricted window.addEventListener("message", …) handler that forwarded every postMessage payload to the Flutter messageHandler JavaScript channel.

Affected location

  • modules/ensemble/lib/widget/fintech/tabapayconnect.dart
  • modules/ensemble/lib/widget/fintech/tabapay_post_message.dart

Attack path

  • Attacker: Cross-origin page or embedded iframe that can postMessage into the WebView window.
  • Input: Arbitrary event.data shaped like TabaPay success payloads (last4|expiration|token|zip).
  • Reach: Injected JS → messageHandler_handleTabaPayMessageonSuccess YAML action.
  • Impact: Spoofed payment success with attacker-controlled token data.

Severity

Medium

Fix

Restrict forwarding to messages whose event.origin matches the configured iframe URL origin; fail closed for invalid URLs.

Tests

modules/ensemble/test/tabapay_post_message_test.dart

Open in Web View Automation 

The TabaPay WebView installed an unrestricted window message listener that
forwarded every postMessage payload to the Flutter messageHandler channel.
A cross-origin frame or page could spoof payment success callbacks and trigger
YAML-defined onSuccess actions with attacker-controlled token data.

Restrict forwarding to messages whose origin matches the configured iframe URL
and fail closed when the URL is not a valid http(s) origin. Add regression
tests for the generated listener script.

Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/application-security-review-905b branch 4 times, most recently from af2bf1a to c88dd07 Compare June 18, 2026 09:16
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.

1 participant