Changeset 248832 in webkit
- Timestamp:
- Aug 18, 2019 12:38:08 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r248831 r248832 1 2019-08-18 Per Arne Vollan <pvollan@apple.com> 2 3 [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions 4 https://bugs.webkit.org/show_bug.cgi?id=200543 5 <rdar://problem/49394015> 6 7 Reviewed by Brent Fulgham. 8 9 Add new SPI. 10 11 * wtf/Platform.h: 12 * wtf/spi/darwin/SandboxSPI.h: 13 1 14 2019-08-17 Darin Adler <darin@apple.com> 2 15 -
trunk/Source/WTF/wtf/Platform.h
r248823 r248832 1535 1535 #endif 1536 1536 1537 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) 1538 #define HAVE_SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID 1 1539 #endif 1540 1537 1541 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) 1538 1542 #define HAVE_MDNS_FAST_REGISTRATION 1 -
trunk/Source/WTF/wtf/spi/darwin/SandboxSPI.h
r248731 r248832 59 59 extern const enum sandbox_filter_type SANDBOX_CHECK_NO_REPORT; 60 60 61 extern const uint32_t SANDBOX_EXTENSION_USER_INTENT; 62 61 63 char *sandbox_extension_issue_file(const char *extension_class, const char *path, uint32_t flags); 62 64 char *sandbox_extension_issue_generic(const char *extension_class, uint32_t flags); 63 65 char *sandbox_extension_issue_mach_to_process_by_pid(const char *extension_class, const char *name, uint32_t flags, pid_t); 66 char *sandbox_extension_issue_file_to_process_by_pid(const char *extension_class, const char *path, uint32_t flags, pid_t); 64 67 int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...); 65 68 int sandbox_check_by_audit_token(audit_token_t, const char *operation, enum sandbox_filter_type, ...); -
trunk/Source/WebKit/ChangeLog
r248828 r248832 1 2019-08-18 Per Arne Vollan <pvollan@apple.com> 2 3 [Mac] Use the PID of the WebContent process when issuing local file read sandbox extensions 4 https://bugs.webkit.org/show_bug.cgi?id=200543 5 <rdar://problem/49394015> 6 7 Reviewed by Brent Fulgham. 8 9 Adopt SPI to issue a process-specific sandbox extension for local file read, passing it the process 10 identifier of the WebContent process. 11 12 * Shared/Cocoa/SandboxExtensionCocoa.mm: 13 (WebKit::SandboxExtensionImpl::sandboxExtensionForType): 14 (WebKit::SandboxExtension::createHandleForReadByPid): 15 * Shared/SandboxExtension.h: 16 * UIProcess/Cocoa/WebPageProxyCocoa.mm: 17 (WebKit::WebPageProxy::createSandboxExtensionsIfNeeded): 18 * UIProcess/WebPageProxy.cpp: 19 (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): 20 (WebKit::WebPageProxy::loadFile): 21 1 22 2019-08-17 Tim Horton <timothy_horton@apple.com> 2 23 -
trunk/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm
r248762 r248832 102 102 case SandboxExtension::Type::Generic: 103 103 return sandbox_extension_issue_generic(path, 0); 104 case SandboxExtension::Type::ReadByPid: 105 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 106 return sandbox_extension_issue_file_to_process_by_pid(APP_SANDBOX_READ, path, SANDBOX_EXTENSION_USER_INTENT, pid.value()); 107 #else 108 UNUSED_PARAM(pid); 109 ASSERT_NOT_REACHED(); 110 return nullptr; 111 #endif 104 112 } 105 113 } … … 338 346 } 339 347 348 bool SandboxExtension::createHandleForReadByPid(const String& path, ProcessID pid, Handle& handle) 349 { 350 ASSERT(!handle.m_sandboxExtension); 351 352 if (!pid) 353 return false; 354 355 handle.m_sandboxExtension = SandboxExtensionImpl::create(path.utf8().data(), Type::ReadByPid, pid); 356 if (!handle.m_sandboxExtension) { 357 WTFLogAlways("Could not create sandbox extension"); 358 return false; 359 } 360 361 return true; 362 } 363 340 364 SandboxExtension::SandboxExtension(const Handle& handle) 341 365 : m_sandboxExtension(WTFMove(handle.m_sandboxExtension)) -
trunk/Source/WebKit/Shared/SandboxExtension.h
r248731 r248832 50 50 Mach, 51 51 Generic, 52 ReadByPid 52 53 }; 53 54 … … 105 106 static bool createHandleForGenericExtension(const String& extensionClass, Handle&); 106 107 static bool createHandleForMachLookupByPid(const String& service, ProcessID, Handle&); 108 static bool createHandleForReadByPid(const String& path, ProcessID, Handle&); 107 109 ~SandboxExtension(); 108 110 -
trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
r248713 r248832 127 127 BOOL isDirectory; 128 128 if ([[NSFileManager defaultManager] fileExistsAtPath:files[0] isDirectory:&isDirectory] && !isDirectory) { 129 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 130 if (!SandboxExtension::createHandleForReadByPid("/", processIdentifier(), fileReadHandle)) 131 #endif 129 132 SandboxExtension::createHandle("/", SandboxExtension::Type::ReadOnly, fileReadHandle); 130 133 willAcquireUniversalFileReadSandboxExtension(m_process); -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r248731 r248832 1077 1077 ASSERT_WITH_SECURITY_IMPLICATION(!WebKit::isInspectorPage(*this)); 1078 1078 1079 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 1080 if (SandboxExtension::createHandleForReadByPid("/", process.processIdentifier(), sandboxExtensionHandle)) { 1081 willAcquireUniversalFileReadSandboxExtension(process); 1082 return; 1083 } 1084 #endif 1079 1085 if (SandboxExtension::createHandle("/", SandboxExtension::Type::ReadOnly, sandboxExtensionHandle)) { 1080 1086 willAcquireUniversalFileReadSandboxExtension(process); … … 1195 1201 loadParameters.shouldOpenExternalURLsPolicy = ShouldOpenExternalURLsPolicy::ShouldNotAllow; 1196 1202 loadParameters.userData = UserData(process().transformObjectsToHandles(userData).get()); 1203 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 1204 if (!SandboxExtension::createHandleForReadByPid(resourceDirectoryPath, processIdentifier(), loadParameters.sandboxExtensionHandle)) 1205 #endif 1197 1206 SandboxExtension::createHandle(resourceDirectoryPath, SandboxExtension::Type::ReadOnly, loadParameters.sandboxExtensionHandle); 1198 1207 addPlatformLoadParameters(loadParameters);
Note: See TracChangeset
for help on using the changeset viewer.