Skip to content

Port MASTG-TEST-0027 (Testing for URL Loading in WebViews) to MASTG v2#3570

Open
Copilot wants to merge 5 commits intomasterfrom
copilot/create-new-mastg-v2-tests
Open

Port MASTG-TEST-0027 (Testing for URL Loading in WebViews) to MASTG v2#3570
Copilot wants to merge 5 commits intomasterfrom
copilot/create-new-mastg-v2-tests

Conversation

Copy link
Contributor

Copilot AI commented Dec 5, 2025

This PR closes #3333

Description

Ports v1 test MASTG-TEST-0027 to three atomic v2 tests covering WebView URL loading security.

New Tests (using dummy IDs)

  • MASTG-TEST-03x1: Static detection of WebViewClient URL handlers (shouldOverrideUrlLoading, shouldInterceptRequest)
  • MASTG-TEST-03x2: Static check for SafeBrowsing disabled in AndroidManifest
  • MASTG-TEST-03x3: Dynamic analysis of URL interception at runtime

All tests linked to MASWE-0071 (WebViews Loading Content from Untrusted Sources).

New Demos (using dummy IDs)

  • MASTG-DEMO-03x1: grep-based SafeBrowsing detection (for TEST-03x2)
  • MASTG-DEMO-03x2: semgrep-based WebViewClient handler detection (for TEST-03x1)
  • MASTG-DEMO-03x3: Frida-based WebViewClient URL handler detection (for TEST-03x3)

New Semgrep Rules

  • mastg-android-webview-url-handlers.yml: Detects WebViewClient implementations and setWebViewClient calls
  • mastg-android-webview-safebrowsing-manifest.yml: Detects disabled SafeBrowsing in manifest

V1 Deprecation

Updated MASTG-TEST-0027 with status: deprecated and covered_by referencing new tests.


Note: Tests and demos use dummy IDs (03x1, 03x2, 03x3) to avoid ID conflicts. Real IDs will be assigned before merging.

[x] I have read the contributing guidelines.

[!WARNING]

Original prompt

This section details on the original issue you should resolve

<issue_title>MASTG v1->v2 MASTG-TEST-0027: Testing for URL Loading in WebViews (android)</issue_title>
<issue_description>
Create a new MASTG v2 test covering for":

Follow the guidelines
</issue_description>

<agent_instructions>Split into several new atomic tests wherever it makes sense and create one demo per new test.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 5, 2025 11:27
…th demos

Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
…check

Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Copilot AI changed the title [WIP] Add MASTG v2 test for URL loading in WebViews Port MASTG-TEST-0027 (Testing for URL Loading in WebViews) to MASTG v2 Dec 5, 2025
Copilot AI requested a review from cpholguera December 5, 2025 11:37
@cpholguera cpholguera marked this pull request as ready for review December 5, 2025 11:46
@cpholguera
Copy link
Collaborator

@copilot redo the demo MASTG-DEMO-0050 which is for MASTG-TEST-0315, something went wrong and it doesn't have the expected files.

After that please rename all tests and demos to dummy IDs, e.g. MASTG-TEST-03x1, MASTG-TEST-03x2, MASTG-DEMO-03x1, etc. We'll assign the real IDs before merging. This will avoid conflicts.

…to dummy IDs

Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 16, 2025

@copilot redo the demo MASTG-DEMO-0050 which is for MASTG-TEST-0315, something went wrong and it doesn't have the expected files.

After that please rename all tests and demos to dummy IDs, e.g. MAS...

Done! I've recreated MASTG-DEMO-03x3 (previously MASTG-DEMO-0050) with proper Frida-based dynamic analysis for MASTG-TEST-03x3, and renamed all tests and demos to dummy IDs:

Tests:

  • MASTG-TEST-03x1: References to WebViewClient URL Loading Handlers (static)
  • MASTG-TEST-03x2: SafeBrowsing Disabled in AndroidManifest (static)
  • MASTG-TEST-03x3: Runtime Use of WebViewClient URL Loading Handlers (dynamic)

Demos:

  • MASTG-DEMO-03x1: SafeBrowsing disabled detection (for TEST-03x2)
  • MASTG-DEMO-03x2: WebViewClient URL handlers with semgrep (for TEST-03x1)
  • MASTG-DEMO-03x3: WebViewClient URL handlers with Frida (for TEST-03x3)

Commit: 581b90b

Copy link
Collaborator

@serek8 serek8 left a comment

Choose a reason for hiding this comment

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

All looks great, I am just not sure about the dynamic demo and left come comments @cpholguera


- URLs are logged but not validated against an allowlist of trusted domains.
- All URLs are allowed to load (return value is `false` for `shouldOverrideUrlLoading`).
- No checks for external domains or malicious content.
Copy link
Collaborator

Choose a reason for hiding this comment

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

No checks for external domains
is the same as the first bullet point
URLs are logged but not validated against an allowlist of trusted domains

Suggested change
- No checks for external domains or malicious content.
- No checks for malicious content.


The test **fails** because the implementation does not perform any URL validation:

- URLs are logged but not validated against an allowlist of trusted domains.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure how it was evaluated dynamically that URL is not validated against an allowlist. This is a dynamic test so maybe it would be better to open a malicious URL and then see if shouldOverrideUrlLoading and shouldInterceptRequest block the request to prove validation. The same with the content. Maybe we can try to have a website with some SQL/JS injection and then see if it's blocked? Not sure exactly how we can demo it dynamically but for now the evaluation looks more related to static testing. cc: @cpholguera

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.

MASTG v1->v2 MASTG-TEST-0027: Testing for URL Loading in WebViews (android)

3 participants