Changeset 248440 in webkit
- Timestamp:
- Aug 8, 2019 1:32:41 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r248386 r248440 1 2019-08-08 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-07 Chris Dumez <cdumez@apple.com> 2 15 -
trunk/Source/WTF/wtf/Platform.h
r248319 r248440 1531 1531 #endif 1532 1532 1533 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) 1534 #define HAVE_SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID 1 1535 #endif 1536 1533 1537 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000) 1534 1538 #define HAVE_MDNS_FAST_REGISTRATION 1 -
trunk/Source/WTF/wtf/spi/darwin/SandboxSPI.h
r243034 r248440 65 65 char *sandbox_extension_issue_generic(const char *extension_class, uint32_t flags); 66 66 char *sandbox_extension_issue_mach_to_process_by_pid(const char *extension_class, const char *name, uint32_t flags, pid_t); 67 char *sandbox_extension_issue_file_to_process_by_pid(const char *extension_class, const char *path, uint32_t flags, pid_t); 67 68 int sandbox_check(pid_t, const char *operation, enum sandbox_filter_type, ...); 68 69 int sandbox_check_by_audit_token(audit_token_t, const char *operation, enum sandbox_filter_type, ...); -
trunk/Source/WebKit/ChangeLog
r248438 r248440 1 2019-08-08 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 6 Reviewed by Brent Fulgham. 7 8 Adopt SPI to issue a process-specific sandbox extension for local file read, passing it the process 9 identifier of the WebContent process. 10 11 * Shared/Cocoa/SandboxExtensionCocoa.mm: 12 (WebKit::SandboxExtensionImpl::sandboxExtensionForType): 13 (WebKit::SandboxExtension::createHandleForReadByPid): 14 * Shared/SandboxExtension.h: 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::maybeInitializeSandboxExtensionHandle): 17 1 18 2019-08-08 Said Abou-Hallawa <sabouhallawa@apple.com> 2 19 -
trunk/Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm
r244969 r248440 101 101 case SandboxExtension::Type::Generic: 102 102 return sandbox_extension_issue_generic(path, 0); 103 case SandboxExtension::Type::ReadByPid: 104 #if HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 105 return sandbox_extension_issue_file_to_process_by_pid(APP_SANDBOX_READ, path, 0, pid.value()); 106 #else 107 UNUSED_PARAM(pid); 108 ASSERT_NOT_REACHED(); 109 return nullptr; 110 #endif 103 111 } 104 112 } … … 337 345 } 338 346 347 bool SandboxExtension::createHandleForReadByPid(const String& path, ProcessID pid, Handle& handle) 348 { 349 ASSERT(!handle.m_sandboxExtension); 350 351 handle.m_sandboxExtension = SandboxExtensionImpl::create(path.utf8().data(), Type::ReadByPid, pid); 352 if (!handle.m_sandboxExtension) { 353 WTFLogAlways("Could not create a '%s' sandbox extension", path.utf8().data()); 354 return false; 355 } 356 357 return true; 358 } 359 339 360 SandboxExtension::SandboxExtension(const Handle& handle) 340 361 : m_sandboxExtension(WTFMove(handle.m_sandboxExtension)) -
trunk/Source/WebKit/Shared/SandboxExtension.h
r243054 r248440 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/WebPageProxy.cpp
r248338 r248440 1077 1077 ASSERT_WITH_SECURITY_IMPLICATION(!WebKit::isInspectorPage(*this)); 1078 1078 1079 #if PLATFORM(MAC) && HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 1080 if (SandboxExtension::createHandleForReadByPid("/", processIdentifier(), sandboxExtensionHandle)) { 1081 #else 1079 1082 if (SandboxExtension::createHandle("/", SandboxExtension::Type::ReadOnly, sandboxExtensionHandle)) { 1083 #endif 1080 1084 willAcquireUniversalFileReadSandboxExtension(process); 1081 1085 return; … … 1090 1094 auto baseURL = URL(URL(), url.baseAsString()); 1091 1095 auto basePath = baseURL.fileSystemPath(); 1092 if (!basePath.isNull() && SandboxExtension::createHandle(basePath, SandboxExtension::Type::ReadOnly, sandboxExtensionHandle)) 1096 if (basePath.isNull()) 1097 return; 1098 #if PLATFORM(MAC) && HAVE(SANDBOX_ISSUE_READ_EXTENSION_TO_PROCESS_BY_PID) 1099 if (SandboxExtension::createHandleForReadByPid(basePath, processIdentifier(), sandboxExtensionHandle)) 1100 #else 1101 if (SandboxExtension::createHandle(basePath, SandboxExtension::Type::ReadOnly, sandboxExtensionHandle)) 1102 #endif 1093 1103 m_process->assumeReadAccessToBaseURL(*this, baseURL); 1094 1104 }
Note: See TracChangeset
for help on using the changeset viewer.