Port MASTG-TEST-0077 WebView file access testing to v2 (iOS)#3591
Open
Port MASTG-TEST-0077 WebView file access testing to v2 (iOS)#3591
Conversation
Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
cpholguera
reviewed
Dec 15, 2025
| profiles: [L1, L2] | ||
| status: deprecated | ||
| covered_by: [MASTG-TEST-0318, MASTG-TEST-0319] | ||
| deprecation_note: "This test has been split into multiple atomic v2 tests. For WebView file access testing, use MASTG-TEST-0318 (static) and MASTG-TEST-0319 (dynamic)." |
Collaborator
There was a problem hiding this comment.
Suggested change
| deprecation_note: "This test has been split into multiple atomic v2 tests. For WebView file access testing, use MASTG-TEST-0318 (static) and MASTG-TEST-0319 (dynamic)." | |
| deprecation_note: New version available in MASTG V2 |
Copilot
AI
changed the title
[WIP] Port MASTG-TEST-0077: Testing WebView Protocol Handlers (ios)
Port MASTG-TEST-0077 WebView file access testing to v2 (iOS)
Dec 15, 2025
Collaborator
|
@copilot add one demo per new test but ignore the UIWebView case |
Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Contributor
Author
Created two demos in bc6ed86:
Both demos focus on WKWebView file access configuration (ignoring UIWebView as requested). |
Contributor
There was a problem hiding this comment.
Pull request overview
Ports the iOS “WebView file access” portion of v1 @MASTG-TEST-0077 into new v2 atomic tests, and adds supporting Knowledge/Demo/Best-Practice content around WKWebView local file loading and relaxed file-origin policies.
Changes:
- Deprecates v1
MASTG-TEST-0077and points it to the new v2 coverage. - Adds two new v2 iOS tests (static + dynamic) for detecting/observing relaxed WKWebView file-origin policies.
- Adds an iOS Knowledge section and two iOS demos (r2 + Frida), plus a new iOS best practice draft.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 21 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ios/MASVS-PLATFORM/MASTG-TEST-0077.md | Deprecates the v1 test and adds covered_by metadata |
| tests-beta/ios/MASVS-PLATFORM/MASTG-TEST-0x01.md | New static v2 test for identifying relaxed file-origin policy configuration |
| tests-beta/ios/MASVS-PLATFORM/MASTG-TEST-0x02.md | New dynamic v2 test for runtime observation of relaxed file-origin policy configuration |
| knowledge/ios/MASVS-PLATFORM/MASTG-KNOW-0076.md | Adds a WebView file access section (UIWebView vs WKWebView + relevant APIs) |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x01/MASTG-DEMO-0x01.md | New static demo write-up for r2-based detection |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x01/MastgTest.swift | Swift sample used by the static demo |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x01/MASTestApp | iOS demo app binary used for static analysis |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x01/output.txt | Static demo observation output |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x01/run.sh | Static demo runner (r2 invocation) |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x01/webview_file_access.r2 | r2 script used by the static demo |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x02/MASTG-DEMO-0x02.md | New dynamic demo write-up for Frida monitoring |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x02/output.txt | Dynamic demo observation output |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x02/run.sh | Dynamic demo runner (Frida invocation) |
| demos/ios/MASVS-PLATFORM/MASTG-DEMO-0x02/script.js | Frida script for hooking WebKit APIs and logging values |
| best-practices/MASTG-BEST-0x01.md | New iOS best practice draft for securely loading local content in WKWebView |
cpholguera
reviewed
Mar 14, 2026
cpholguera
reviewed
Mar 14, 2026
cpholguera
reviewed
Mar 14, 2026
|
|
||
| Remember that JavaScript is enables by default unless the app explicitly calls `setJavaScriptEnabled` to set it to `false`. | ||
|
|
||
| This test is related to, but distinct from, @MASTG-TEST-xxxx, which evaluates the use of `loadFileURL(_:allowingReadAccessTo:)`. That test focuses on the **native file system read scope** granted to the WebView through the `readAccessURL` parameter. By contrast, this test focuses on **JavaScript origin restrictions** for content loaded from `file://` URLs. Even if the file read scope is correctly restricted, enabling `allowFileAccessFromFileURLs` or `allowUniversalAccessFromFileURLs` can allow JavaScript running in a local page to access additional resources or communicate with remote origins. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: Carlos Holguera <perezholguera@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR closes #3185
Description
Ports the WebView file access portion of MASTG-TEST-0077 to v2 atomic tests, mirroring the Android implementation in MASTG-TEST-0252/0253.
New Tests:
allowFileAccessFromFileURLs,allowUniversalAccessFromFileURLs(undocumented KVC-only properties),UIWebViewusage, andloadFileURL:allowingReadAccessToURL:configurationsBest Practice:
baseURLhandlingKnowledge Updates:
Demos:
Deprecation:
covered_byreferences to new testsAll tests reference MASWE-0069 and link to platform-specific knowledge (MASTG-KNOW-0076) and best practices. The demos focus on WKWebView only (UIWebView excluded as deprecated).
[x] I have read the contributing guidelines.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.