Bug 228991 - [iOS] Cannot load files from sandbox when crossing containers
Summary: [iOS] Cannot load files from sandbox when crossing containers
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: WebKit Local Build
Hardware: iPhone / iPad iOS 14
: P2 Major
Assignee: WebKit Security Group
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-08-11 03:58 PDT by Alex Fioletov
Modified: 2022-01-31 08:37 PST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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>