Changeset 260316 in webkit
- Timestamp:
- Apr 18, 2020 9:35:05 AM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r260303 r260316 1 2020-04-18 David Kilzer <ddkilzer@apple.com> 2 3 [IPC hardening] Use MESSAGE_CHECK in WebPasteboardProxy 4 <https://webkit.org/b/210684> 5 <rdar://problem/59906721> 6 7 Reviewed by Wenson Hsieh. 8 9 * UIProcess/Cocoa/WebPasteboardProxyCocoa.mm: 10 - Add missing #undef of MESSAGE_CHECK_COMPLETION and 11 MESSAGE_CHECK_WITH_RETURN_VALUE. 12 (WebKit::WebPasteboardProxy::getPasteboardPathnamesForType): 13 (WebKit::WebPasteboardProxy::getPasteboardStringForType): 14 (WebKit::WebPasteboardProxy::getPasteboardStringsForType): 15 (WebKit::WebPasteboardProxy::getPasteboardBufferForType): 16 (WebKit::WebPasteboardProxy::setPasteboardStringForType): 17 (WebKit::WebPasteboardProxy::setPasteboardBufferForType): 18 (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): 19 (WebKit::WebPasteboardProxy::readStringFromPasteboard): 20 (WebKit::WebPasteboardProxy::readBufferFromPasteboard): 21 - Replace existing code with MESSAGE_CHECK_COMPLETION macros. 22 23 * UIProcess/WebPasteboardProxy.cpp: 24 (WebKit::WebPasteboardProxy::typesSafeForDOMToReadAndWrite): 25 * UIProcess/WebPasteboardProxy.h: 26 * UIProcess/WebPasteboardProxy.messages.in: 27 - Add IPC::Connection to TypesSafeForDOMToReadAndWrite. 28 1 29 2020-04-17 Kate Cheney <katherine_cheney@apple.com> 2 30 -
trunk/Source/WebKit/UIProcess/Cocoa/WebPasteboardProxyCocoa.mm
r259346 r260316 128 128 CompletionHandler<void(Vector<String>&& pathnames, SandboxExtension::HandleArray&& sandboxExtensions)>&& completionHandler) 129 129 { 130 ASSERT(!pasteboardType.isNull()); 131 if (pasteboardType.isNull()) 132 return completionHandler({ }, { }); 130 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }, { })); 133 131 134 132 // FIXME: This should consult canAccessPasteboardData() as well, and avoid responding with file paths if it returns false. … … 154 152 void WebPasteboardProxy::getPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(String&&)>&& completionHandler) 155 153 { 154 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ })); 155 156 156 if (!canAccessPasteboardData(connection, pasteboardName)) 157 157 return completionHandler({ }); 158 158 159 ASSERT(!pasteboardType.isNull()); 160 if (pasteboardType.isNull()) 159 completionHandler(PlatformPasteboard(pasteboardName).stringForType(pasteboardType)); 160 } 161 162 void WebPasteboardProxy::getPasteboardStringsForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 163 { 164 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ })); 165 166 if (!canAccessPasteboardData(connection, pasteboardName)) 161 167 return completionHandler({ }); 162 168 163 completionHandler(PlatformPasteboard(pasteboardName).stringForType(pasteboardType));164 }165 166 void WebPasteboardProxy::getPasteboardStringsForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(Vector<String>&&)>&& completionHandler)167 {168 ASSERT(!pasteboardType.isNull());169 if (pasteboardType.isNull())170 return completionHandler({ });171 172 if (!canAccessPasteboardData(connection, pasteboardName))173 return completionHandler({ });174 175 169 completionHandler(PlatformPasteboard(pasteboardName).allStringsForType(pasteboardType)); 176 170 } … … 178 172 void WebPasteboardProxy::getPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, CompletionHandler<void(SharedMemory::Handle&&, uint64_t)>&& completionHandler) 179 173 { 180 ASSERT(!pasteboardType.isNull()); 181 if (pasteboardType.isNull()) 182 return completionHandler({ }, 0); 174 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }, 0)); 183 175 184 176 if (!canAccessPasteboardData(connection, pasteboardName)) … … 261 253 void WebPasteboardProxy::setPasteboardStringForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const String& string, CompletionHandler<void(int64_t)>&& completionHandler) 262 254 { 263 ASSERT(!pasteboardType.isNull()); 264 if (pasteboardType.isNull()) 265 return completionHandler(0); 255 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler(0)); 266 256 267 257 auto previousChangeCount = PlatformPasteboard(pasteboardName).changeCount(); … … 288 278 void WebPasteboardProxy::setPasteboardBufferForType(IPC::Connection& connection, const String& pasteboardName, const String& pasteboardType, const SharedMemory::Handle& handle, uint64_t size, CompletionHandler<void(int64_t)>&& completionHandler) 289 279 { 290 ASSERT(!pasteboardType.isNull()); 291 if (pasteboardType.isNull()) 292 return completionHandler(0); 280 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler(0)); 293 281 294 282 auto previousChangeCount = PlatformPasteboard(pasteboardName).changeCount(); … … 316 304 } 317 305 318 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 319 { 320 ASSERT(!origin.isNull()); 321 if (origin.isNull()) 322 return completionHandler({ }); 306 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(IPC::Connection& connection, const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 307 { 308 MESSAGE_CHECK_COMPLETION(!origin.isNull(), completionHandler({ })); 323 309 324 310 completionHandler(PlatformPasteboard(pasteboardName).typesSafeForDOMToReadAndWrite(origin)); … … 350 336 void WebPasteboardProxy::readStringFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(String&&)>&& completionHandler) 351 337 { 352 ASSERT(!pasteboardType.isNull()); 353 if (pasteboardType.isNull()) 354 return completionHandler({ }); 338 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ })); 355 339 356 340 if (!canAccessPasteboardData(connection, pasteboardName)) … … 372 356 void WebPasteboardProxy::readBufferFromPasteboard(IPC::Connection& connection, size_t index, const String& pasteboardType, const String& pasteboardName, CompletionHandler<void(SharedMemory::Handle&&, uint64_t size)>&& completionHandler) 373 357 { 374 ASSERT(!pasteboardType.isNull()); 375 if (pasteboardType.isNull()) 376 return completionHandler({ }, 0); 358 MESSAGE_CHECK_COMPLETION(!pasteboardType.isNull(), completionHandler({ }, 0)); 377 359 378 360 if (!canAccessPasteboardData(connection, pasteboardName)) … … 438 420 } // namespace WebKit 439 421 422 #undef MESSAGE_CHECK_COMPLETION 423 #undef MESSAGE_CHECK_WITH_RETURN_VALUE 440 424 #undef MESSAGE_CHECK -
trunk/Source/WebKit/UIProcess/WebPasteboardProxy.cpp
r259151 r260316 80 80 #if !PLATFORM(COCOA) 81 81 82 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite( const String&, const String&, CompletionHandler<void(Vector<String>&&)>&& completionHandler)82 void WebPasteboardProxy::typesSafeForDOMToReadAndWrite(IPC::Connection&, const String&, const String&, CompletionHandler<void(Vector<String>&&)>&& completionHandler) 83 83 { 84 84 completionHandler({ }); -
trunk/Source/WebKit/UIProcess/WebPasteboardProxy.h
r259151 r260316 112 112 113 113 void writeCustomData(IPC::Connection&, const Vector<WebCore::PasteboardCustomData>&, const String& pasteboardName, CompletionHandler<void(int64_t)>&&); 114 void typesSafeForDOMToReadAndWrite( const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&);114 void typesSafeForDOMToReadAndWrite(IPC::Connection&, const String& pasteboardName, const String& origin, CompletionHandler<void(Vector<String>&&)>&&); 115 115 void containsStringSafeForDOMToReadForType(const String&, const String& pasteboardName, CompletionHandler<void(bool)>&&); 116 116 void containsURLStringSuitableForLoading(const String& pasteboardName, CompletionHandler<void(bool)>&&); -
trunk/Source/WebKit/UIProcess/WebPasteboardProxy.messages.in
r259151 r260316 31 31 32 32 WriteCustomData(Vector<WebCore::PasteboardCustomData> data, String pasteboardName) -> (int64_t changeCount) Synchronous WantsConnection 33 TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Synchronous 33 TypesSafeForDOMToReadAndWrite(String pasteboardName, String origin) -> (Vector<String> types) Synchronous WantsConnection 34 34 AllPasteboardItemInfo(String pasteboardName, int64_t changeCount) -> (Optional<Vector<WebCore::PasteboardItemInfo>> allInfo) Synchronous 35 35 InformationForItemAtIndex(uint64_t index, String pasteboardName, int64_t changeCount) -> (Optional<WebCore::PasteboardItemInfo> info) Synchronous
Note: See TracChangeset
for help on using the changeset viewer.