Bug 228991

Summary: [iOS] Cannot load files from sandbox when crossing containers
Product: WebKit Reporter: Alex Fioletov <Alex_fioletov>
Component: WebKit APIAssignee: WebKit Security Group <webkit-security-unassigned>
Status: NEW ---    
Severity: Major CC: achristensen, Alex_fioletov, beidson, bfulgham, pvollan, webkit-bug-importer, wilander
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: iPhone / iPad   
OS: iOS 14   

Description Alex Fioletov 2021-08-11 03:58:47 PDT
WebKit loads local files with no issues if all resources are int the same container e.g. in the bungle continer or in the cache folder of data container. 
Attempt to change location between sandbox's containers causes error:
2021-07-30 10:06:33.742306-0400 InMotionTestApp[2318:560700] [Loading] Received an unexpected URL from the web process
2021-07-30 10:06:33.742441-0400 InMotionTestApp[2318:560700] [Process] 0x10202ca18 - [pageProxyID=11, webPageID=12, PID=2321] WebPageProxy::Ignoring request to load this main resource because it is outside the sandbox

Initially it happened in Cordova application that we switches to WebKit. It downloads updated version of site to cache folder and if there is downloaded update it tries to change location like:

window.location='file:///var/mobile/Containers/Data/Application/GUID/Library/Caches/1.11.00000.0000/www/Default.html'

I made a simple swift test application that load page from bundle and then tries to change window.location to file from cached folder. And got the same error. 
Based on this article bundle and data containers are part of sandbox: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html
But WebKit cannot cross containers' boundaries. I can load page from cache folder, but if it tries to load some resources (scripts) from bundle container, such requests fail as well. 

Is there configuration settings that allows to load all files within sandbox?
Comment 1 Radar WebKit Bug Importer 2021-08-11 03:58:58 PDT
<rdar://problem/81786779>