feat(paywalls): web_view navigation/origin policy (3/7)#7229
Merged
Conversation
…3/7) Extract origin normalization, main-frame navigation policy, and WK content rule isolation as inert helpers used by later session/view PRs. Co-authored-by: Jacob Rakidzich <Jacob@JacobZivanDesign.com>
This was referenced Jul 15, 2026
JZDesign
marked this pull request as ready for review
July 16, 2026 12:47
ajpallares
reviewed
Jul 17, 2026
ajpallares
reviewed
Jul 17, 2026
Merge the content-blocking rule into a single item and extend the third-party block list (style-sheet, media, document). Make contentBlockingRules a non-optional constant, move import WebKit inside the platform guard, and add coverage: real WKContentRuleListStore compilation, http:80 default-port stripping, and adversarial navigation cases (nil URL, scheme downgrade, port mismatch). Co-authored-by: Cursor <cursoragent@cursor.com>
…avigation Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # RevenueCat.xcodeproj/project.pbxproj
Apply the origin check to every frame so cross-origin sub-frames are cancelled (defense-in-depth alongside the content rules), and split the two combined navigation-policy tests into one clearly-named test per case. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b3e0f35. Configure here.
A compile failure means the WebView runs without third-party isolation, so surface it at error level instead of debug where it would be invisible in production. Co-authored-by: Cursor <cursoragent@cursor.com>
Normalize both the URL origin and expectedOrigin before comparing so a non-canonical expectedOrigin (mixed case or explicit default port) no longer cancels legitimate same-origin navigations. An unparseable or host-less expectedOrigin still fails closed. Co-authored-by: Cursor <cursoragent@cursor.com>
AlvaroBrey
approved these changes
Jul 20, 2026
The bundle's served CSP (default-src 'self', per-bundle origin) already blocks cross-origin resource and document loads more completely than the WKContentRuleList did (it also covers stylesheets, media, WebSockets and workers), so the SDK-side content rules were redundant. The navigation origin-lock is kept: CSP has no directive that gates top-level navigation. Co-authored-by: Cursor <cursoragent@cursor.com>
The origin check runs on every frame identically, so `isMainFrame` was never read. Remove it, drop the now-redundant sub-frame tests, and trim comments to current behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
AlvaroBrey
approved these changes
Jul 20, 2026
Restore `isMainFrame` and align the origin policy with purchases-android (#3783): block non-https on any frame, block cross-origin only on the main frame, and leave cross-origin sub-frame isolation to the server-provided CSP (`frame-src` falls back to `default-src 'self'`). Co-authored-by: Cursor <cursoragent@cursor.com>
Member
|
@RCGitBot please test |
…to webview/3-isolation-navigation Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # RevenueCat.xcodeproj/project.pbxproj
ajpallares
enabled auto-merge (squash)
July 21, 2026 07:35
ajpallares
added a commit
that referenced
this pull request
Jul 21, 2026
Retarget Part 5 onto main now that Parts 1-3 (#7227, #7228, #7229) are merged. Resolve conflicts by keeping main's canonical Part 1-3 files (PaywallWebViewValue, WebViewEnvelope, WebViewOriginPolicy and their tests) and dropping stale deps-123 artifacts (PaywallWebViewAPI.swift, WebViewIsolation.swift and its test, plus the now-unused content_rules_failed log string). Part 5's own additions (WebViewSession + tests, log strings) are preserved. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Jul 22, 2026
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.

Checklist
purchases-androidand hybridsMotivation
Part 3 of 7 splitting #7183; inert until Part 7. Lands the navigation/origin policy so the later session and view can share one origin helper.
Description
Adds
WebViewOriginPolicy(WebViewOrigin+WebViewNavigationPolicy) with origin normalization and navigation coverage (default port stripped, non-default kept, case-insensitive, empty host → nil; origin check enforced on sub-frames too).Content-blocking rules are intentionally omitted: the bundle's served CSP (
default-src 'self', per-bundle origin) already blocks cross-origin resource and document loads more completely. CSP has no directive covering top-level navigation, so the origin lock stays.Independent of Parts 1–2. No render-pipeline wiring until Part 7.
PR Plan
PWENG-99