Bug 211211 - Add SPI to change a WKWebView's CORS disabling pattern after initialization
Summary: Add SPI to change a WKWebView's CORS disabling pattern after initialization
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-29 17:17 PDT by Alex Christensen
Modified: 2020-04-30 13:03 PDT (History)
2 users (show)

See Also:


Attachments
Patch (14.87 KB, patch)
2020-04-29 17:20 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
patch with renamed parser (14.94 KB, patch)
2020-04-30 12:25 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2020-04-29 17:17:39 PDT
Add SPI to change a WKWebView's CORS disabling pattern after initialization
Comment 1 Alex Christensen 2020-04-29 17:20:01 PDT
Created attachment 398011 [details]
Patch
Comment 2 Alex Christensen 2020-04-29 17:20:03 PDT
<rdar://problem/61837474>
Comment 3 Chris Dumez 2020-04-30 11:41:58 PDT
Comment on attachment 398011 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=398011&action=review

> Source/WebKit/WebProcess/WebPage/WebPage.cpp:403
> +            WebCore::SecurityPolicy::allowAccessTo(parsedPattern);

This method says it is parsing things, however it is calling SecurityPolicy::allowAccessTo() too so it is doing way more than parsing.

Another concern. Even though you now support updating those CORS-disabling patterns, you really only ever allow more patterns with regards to SecurityPolicy::originAccessPatterns(). Once a pattern is added there, it does not seem it gets removed.
Another mismatch is that SecurityPolicy::originAccessPatterns() seems to apply at process level, while you patterns are per page.
Comment 4 Alex Christensen 2020-04-30 11:54:55 PDT
The user of this SPI will only ever be adding patterns, so this concern isn't really valid for this use case.  It is valid for hypothetical future users of this SPI that reduce patterns, but we should cross that bridge when we come to it.

It is unfortunate that SecurityPolicy is global, but it is the way it is right now.  All loading in the web process is global.

Would you review this patch on the condition that parseCORSDisablingPatterns be renamed to parseAndAllowAccessToCORSDisablingPatterns?
Comment 5 Alex Christensen 2020-04-30 12:25:31 PDT
Created attachment 398080 [details]
patch with renamed parser
Comment 6 EWS 2020-04-30 13:03:32 PDT
Committed r260962: <https://trac.webkit.org/changeset/260962>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 398080 [details].