Changeset 242378 in webkit
- Timestamp:
- Mar 4, 2019, 1:01:37 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/Cocoa/PlaybackSessionManagerProxy.mm (modified) (21 diffs)
-
UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (modified) (9 diffs)
-
UIProcess/Cocoa/VideoFullscreenManagerProxy.mm (modified) (13 diffs)
-
UIProcess/ios/EditableImageController.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r242377 r242378 1 2019-03-04 Brent Fulgham <bfulgham@apple.com> 2 3 Check contextIDs when handling WebContent messages 4 https://bugs.webkit.org/show_bug.cgi?id=195289 5 <rdar://problem/48475870> 6 7 Reviewed by Alex Christensen. 8 9 The WebContent process is untrusted because it handles arbitrary markup and javascript from untrusted sources. 10 We should handle its messages with suspicion, and make sure the arguments are valid and usable before honoring them. 11 12 This patch hardens the message passing layer by performing MESSAGE_CHECK in places that had been overlooked. 13 14 * UIProcess/Cocoa/PlaybackSessionManagerProxy.mm: 15 (WebKit::PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID): 16 (WebKit::PlaybackSessionManagerProxy::currentTimeChanged): 17 (WebKit::PlaybackSessionManagerProxy::bufferedTimeChanged): 18 (WebKit::PlaybackSessionManagerProxy::seekableRangesVectorChanged): 19 (WebKit::PlaybackSessionManagerProxy::canPlayFastReverseChanged): 20 (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged): 21 (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged): 22 (WebKit::PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged): 23 (WebKit::PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged): 24 (WebKit::PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged): 25 (WebKit::PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged): 26 (WebKit::PlaybackSessionManagerProxy::mutedChanged): 27 (WebKit::PlaybackSessionManagerProxy::volumeChanged): 28 (WebKit::PlaybackSessionManagerProxy::durationChanged): 29 (WebKit::PlaybackSessionManagerProxy::playbackStartedTimeChanged): 30 (WebKit::PlaybackSessionManagerProxy::rateChanged): 31 (WebKit::PlaybackSessionManagerProxy::pictureInPictureSupportedChanged): 32 (WebKit::PlaybackSessionManagerProxy::pictureInPictureActiveChanged): 33 (WebKit::PlaybackSessionManagerProxy::handleControlledElementIDResponse const): 34 * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: 35 (WebKit::UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints): 36 (WebKit::UserMediaCaptureManagerProxy::startProducingData): 37 (WebKit::UserMediaCaptureManagerProxy::stopProducingData): 38 (WebKit::UserMediaCaptureManagerProxy::end): 39 (WebKit::UserMediaCaptureManagerProxy::capabilities): 40 (WebKit::UserMediaCaptureManagerProxy::setMuted): 41 (WebKit::UserMediaCaptureManagerProxy::applyConstraints): 42 * UIProcess/Cocoa/VideoFullscreenManagerProxy.mm: 43 (WebKit::VideoFullscreenManagerProxy::setupFullscreenWithID): 44 (WebKit::VideoFullscreenManagerProxy::setHasVideo): 45 (WebKit::VideoFullscreenManagerProxy::setVideoDimensions): 46 (WebKit::VideoFullscreenManagerProxy::enterFullscreen): 47 (WebKit::VideoFullscreenManagerProxy::exitFullscreen): 48 (WebKit::VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode): 49 (WebKit::VideoFullscreenManagerProxy::setInlineRect): 50 (WebKit::VideoFullscreenManagerProxy::setHasVideoContentLayer): 51 (WebKit::VideoFullscreenManagerProxy::cleanupFullscreen): 52 (WebKit::VideoFullscreenManagerProxy::preparedToReturnToInline): 53 (WebKit::VideoFullscreenManagerProxy::preparedToExitFullscreen): 54 * UIProcess/ios/EditableImageController.mm: 55 (WebKit::EditableImageController::didCreateEditableImage): 56 (WebKit::EditableImageController::didDestroyEditableImage): 57 (WebKit::EditableImageController::associateWithAttachment): 58 1 59 2019-03-04 Alex Christensen <achristensen@webkit.org> 2 60 -
trunk/Source/WebKit/UIProcess/Cocoa/PlaybackSessionManagerProxy.mm
r239535 r242378 34 34 #import "WebProcessProxy.h" 35 35 36 #define MESSAGE_CHECK_CONTEXTID(contextID) MESSAGE_CHECK_BASE(m_contextMap.isValidKey(contextId), m_page->process().connection()) 37 36 38 namespace WebKit { 37 39 using namespace WebCore; … … 372 374 void PlaybackSessionManagerProxy::setUpPlaybackControlsManagerWithID(uint64_t contextId) 373 375 { 376 MESSAGE_CHECK_CONTEXTID(contextID); 374 377 if (m_controlsManagerContextId == contextId) 375 378 return; … … 397 400 void PlaybackSessionManagerProxy::currentTimeChanged(uint64_t contextId, double currentTime, double hostTime) 398 401 { 402 MESSAGE_CHECK_CONTEXTID(contextID); 399 403 ensureModel(contextId).currentTimeChanged(currentTime); 400 404 } … … 402 406 void PlaybackSessionManagerProxy::bufferedTimeChanged(uint64_t contextId, double bufferedTime) 403 407 { 408 MESSAGE_CHECK_CONTEXTID(contextID); 404 409 ensureModel(contextId).bufferedTimeChanged(bufferedTime); 405 410 } … … 407 412 void PlaybackSessionManagerProxy::seekableRangesVectorChanged(uint64_t contextId, Vector<std::pair<double, double>> ranges, double lastModifiedTime, double liveUpdateInterval) 408 413 { 414 MESSAGE_CHECK_CONTEXTID(contextID); 409 415 Ref<TimeRanges> timeRanges = TimeRanges::create(); 410 416 for (const auto& range : ranges) { … … 420 426 void PlaybackSessionManagerProxy::canPlayFastReverseChanged(uint64_t contextId, bool value) 421 427 { 428 MESSAGE_CHECK_CONTEXTID(contextID); 422 429 ensureModel(contextId).canPlayFastReverseChanged(value); 423 430 } … … 425 432 void PlaybackSessionManagerProxy::audioMediaSelectionOptionsChanged(uint64_t contextId, Vector<MediaSelectionOption> options, uint64_t selectedIndex) 426 433 { 434 MESSAGE_CHECK_CONTEXTID(contextID); 427 435 ensureModel(contextId).audioMediaSelectionOptionsChanged(options, selectedIndex); 428 436 } … … 430 438 void PlaybackSessionManagerProxy::legibleMediaSelectionOptionsChanged(uint64_t contextId, Vector<MediaSelectionOption> options, uint64_t selectedIndex) 431 439 { 440 MESSAGE_CHECK_CONTEXTID(contextID); 432 441 ensureModel(contextId).legibleMediaSelectionOptionsChanged(options, selectedIndex); 433 442 } … … 435 444 void PlaybackSessionManagerProxy::audioMediaSelectionIndexChanged(uint64_t contextId, uint64_t selectedIndex) 436 445 { 446 MESSAGE_CHECK_CONTEXTID(contextID); 437 447 ensureModel(contextId).audioMediaSelectionIndexChanged(selectedIndex); 438 448 } … … 440 450 void PlaybackSessionManagerProxy::legibleMediaSelectionIndexChanged(uint64_t contextId, uint64_t selectedIndex) 441 451 { 452 MESSAGE_CHECK_CONTEXTID(contextID); 442 453 ensureModel(contextId).legibleMediaSelectionIndexChanged(selectedIndex); 443 454 } … … 445 456 void PlaybackSessionManagerProxy::externalPlaybackPropertiesChanged(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName) 446 457 { 458 MESSAGE_CHECK_CONTEXTID(contextID); 447 459 PlaybackSessionModel::ExternalPlaybackTargetType type = static_cast<PlaybackSessionModel::ExternalPlaybackTargetType>(targetType); 448 460 ASSERT(type == PlaybackSessionModel::TargetTypeAirPlay || type == PlaybackSessionModel::TargetTypeTVOut || type == PlaybackSessionModel::TargetTypeNone); … … 453 465 void PlaybackSessionManagerProxy::wirelessVideoPlaybackDisabledChanged(uint64_t contextId, bool disabled) 454 466 { 467 MESSAGE_CHECK_CONTEXTID(contextID); 455 468 ensureModel(contextId).wirelessVideoPlaybackDisabledChanged(disabled); 456 469 } … … 458 471 void PlaybackSessionManagerProxy::mutedChanged(uint64_t contextId, bool muted) 459 472 { 473 MESSAGE_CHECK_CONTEXTID(contextID); 460 474 ensureModel(contextId).mutedChanged(muted); 461 475 } … … 463 477 void PlaybackSessionManagerProxy::volumeChanged(uint64_t contextId, double volume) 464 478 { 479 MESSAGE_CHECK_CONTEXTID(contextID); 465 480 ensureModel(contextId).volumeChanged(volume); 466 481 } … … 468 483 void PlaybackSessionManagerProxy::durationChanged(uint64_t contextId, double duration) 469 484 { 485 MESSAGE_CHECK_CONTEXTID(contextID); 470 486 ensureModel(contextId).durationChanged(duration); 471 487 } … … 473 489 void PlaybackSessionManagerProxy::playbackStartedTimeChanged(uint64_t contextId, double playbackStartedTime) 474 490 { 491 MESSAGE_CHECK_CONTEXTID(contextID); 475 492 ensureModel(contextId).playbackStartedTimeChanged(playbackStartedTime); 476 493 } … … 478 495 void PlaybackSessionManagerProxy::rateChanged(uint64_t contextId, bool isPlaying, double rate) 479 496 { 497 MESSAGE_CHECK_CONTEXTID(contextID); 480 498 ensureModel(contextId).rateChanged(isPlaying, rate); 481 499 } … … 483 501 void PlaybackSessionManagerProxy::pictureInPictureSupportedChanged(uint64_t contextId, bool supported) 484 502 { 503 MESSAGE_CHECK_CONTEXTID(contextID); 485 504 ensureModel(contextId).pictureInPictureSupportedChanged(supported); 486 505 } … … 488 507 void PlaybackSessionManagerProxy::pictureInPictureActiveChanged(uint64_t contextId, bool active) 489 508 { 509 MESSAGE_CHECK_CONTEXTID(contextID); 490 510 ensureModel(contextId).pictureInPictureActiveChanged(active); 491 511 } … … 493 513 void PlaybackSessionManagerProxy::handleControlledElementIDResponse(uint64_t contextId, String identifier) const 494 514 { 515 MESSAGE_CHECK_CONTEXTID(contextID); 495 516 #if PLATFORM(MAC) 496 517 if (contextId == m_controlsManagerContextId) … … 608 629 } // namespace WebKit 609 630 631 #undef MESSAGE_CHECK_CONTEXTID 632 610 633 #endif // PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) -
trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp
r241145 r242378 40 40 #include <wtf/UniqueRef.h> 41 41 42 #define MESSAGE_CHECK_CONTEXTID(id) MESSAGE_CHECK_BASE(m_proxies.isValidKey(id), m_process.connection()) 43 42 44 namespace WebKit { 43 45 using namespace WebCore; … … 140 142 void UserMediaCaptureManagerProxy::createMediaSourceForCaptureDeviceWithConstraints(uint64_t id, const CaptureDevice& device, String&& hashSalt, const MediaConstraints& constraints, bool& succeeded, String& invalidConstraints, WebCore::RealtimeMediaSourceSettings& settings) 141 143 { 144 MESSAGE_CHECK_CONTEXTID(id); 145 142 146 CaptureSourceOrError sourceOrError; 143 147 switch (device.type()) { … … 170 174 void UserMediaCaptureManagerProxy::startProducingData(uint64_t id) 171 175 { 176 MESSAGE_CHECK_CONTEXTID(id); 172 177 auto iter = m_proxies.find(id); 173 178 if (iter != m_proxies.end()) … … 177 182 void UserMediaCaptureManagerProxy::stopProducingData(uint64_t id) 178 183 { 184 MESSAGE_CHECK_CONTEXTID(id); 179 185 auto iter = m_proxies.find(id); 180 186 if (iter != m_proxies.end()) … … 184 190 void UserMediaCaptureManagerProxy::end(uint64_t id) 185 191 { 192 MESSAGE_CHECK_CONTEXTID(id); 186 193 m_proxies.remove(id); 187 194 } … … 189 196 void UserMediaCaptureManagerProxy::capabilities(uint64_t id, WebCore::RealtimeMediaSourceCapabilities& capabilities) 190 197 { 198 MESSAGE_CHECK_CONTEXTID(id); 191 199 auto iter = m_proxies.find(id); 192 200 if (iter != m_proxies.end()) … … 196 204 void UserMediaCaptureManagerProxy::setMuted(uint64_t id, bool muted) 197 205 { 206 MESSAGE_CHECK_CONTEXTID(id); 198 207 auto iter = m_proxies.find(id); 199 208 if (iter != m_proxies.end()) … … 203 212 void UserMediaCaptureManagerProxy::applyConstraints(uint64_t id, const WebCore::MediaConstraints& constraints) 204 213 { 214 MESSAGE_CHECK_CONTEXTID(id); 205 215 auto iter = m_proxies.find(id); 206 216 if (iter == m_proxies.end()) … … 222 232 } 223 233 234 #undef MESSAGE_CHECK_CONTEXTID 235 224 236 #endif -
trunk/Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
r241745 r242378 122 122 #endif 123 123 124 #define MESSAGE_CHECK_CONTEXTID(contextID) MESSAGE_CHECK_BASE(m_contextMap.isValidKey(contextId), m_page->process().connection()) 125 124 126 namespace WebKit { 125 127 using namespace WebCore; … … 469 471 void VideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture, bool standby) 470 472 { 473 MESSAGE_CHECK_CONTEXTID(contextId); 474 471 475 ASSERT(videoLayerID); 472 476 RefPtr<VideoFullscreenModelContext> model; … … 505 509 void VideoFullscreenManagerProxy::setHasVideo(uint64_t contextId, bool hasVideo) 506 510 { 511 MESSAGE_CHECK_CONTEXTID(contextId); 507 512 ensureInterface(contextId).hasVideoChanged(hasVideo); 508 513 } … … 510 515 void VideoFullscreenManagerProxy::setVideoDimensions(uint64_t contextId, const FloatSize& videoDimensions) 511 516 { 517 MESSAGE_CHECK_CONTEXTID(contextId); 512 518 ensureInterface(contextId).videoDimensionsChanged(videoDimensions); 513 519 } … … 515 521 void VideoFullscreenManagerProxy::enterFullscreen(uint64_t contextId) 516 522 { 523 MESSAGE_CHECK_CONTEXTID(contextId); 524 517 525 auto& interface = ensureInterface(contextId); 518 526 interface.enterFullscreen(); … … 532 540 void VideoFullscreenManagerProxy::exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect) 533 541 { 542 MESSAGE_CHECK_CONTEXTID(contextId); 543 534 544 ASSERT(m_contextMap.contains(contextId)); 535 545 if (!m_contextMap.contains(contextId)) … … 548 558 void VideoFullscreenManagerProxy::exitFullscreenWithoutAnimationToMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode) 549 559 { 560 MESSAGE_CHECK_CONTEXTID(contextId); 550 561 ensureInterface(contextId).exitFullscreenWithoutAnimationToMode(targetMode); 551 562 } … … 556 567 void VideoFullscreenManagerProxy::setInlineRect(uint64_t contextId, const WebCore::IntRect& inlineRect, bool visible) 557 568 { 569 MESSAGE_CHECK_CONTEXTID(contextId); 558 570 ensureInterface(contextId).setInlineRect(inlineRect, visible); 559 571 } … … 561 573 void VideoFullscreenManagerProxy::setHasVideoContentLayer(uint64_t contextId, bool value) 562 574 { 575 MESSAGE_CHECK_CONTEXTID(contextId); 563 576 ensureInterface(contextId).setHasVideoContentLayer(value); 564 577 } … … 580 593 void VideoFullscreenManagerProxy::cleanupFullscreen(uint64_t contextId) 581 594 { 595 MESSAGE_CHECK_CONTEXTID(contextId); 582 596 ensureInterface(contextId).cleanupFullscreen(); 583 597 } … … 585 599 void VideoFullscreenManagerProxy::preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect) 586 600 { 601 MESSAGE_CHECK_CONTEXTID(contextId); 587 602 m_page->fullscreenMayReturnToInline(); 588 603 … … 598 613 void VideoFullscreenManagerProxy::preparedToExitFullscreen(uint64_t contextId) 599 614 { 615 MESSAGE_CHECK_CONTEXTID(contextId); 600 616 ensureInterface(contextId).preparedToExitFullscreen(); 601 617 } … … 698 714 } // namespace WebKit 699 715 716 #undef MESSAGE_CHECK_CONTEXTID 717 700 718 #endif // PLATFORM(IOS_FAMILY) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)) -
trunk/Source/WebKit/UIProcess/ios/EditableImageController.mm
r239628 r242378 39 39 #import <wtf/RetainPtr.h> 40 40 41 #define MESSAGE_CHECK_VIEWID(embeddedViewID) MESSAGE_CHECK_BASE(m_editableImages.isValidKey(embeddedViewID), connection()) 42 41 43 namespace WebKit { 42 44 … … 74 76 void EditableImageController::didCreateEditableImage(WebCore::GraphicsLayer::EmbeddedViewID embeddedViewID) 75 77 { 78 MESSAGE_CHECK_VIEWID(embeddedViewID); 76 79 ensureEditableImage(embeddedViewID); 77 80 } … … 79 82 void EditableImageController::didDestroyEditableImage(WebCore::GraphicsLayer::EmbeddedViewID embeddedViewID) 80 83 { 84 MESSAGE_CHECK_VIEWID(embeddedViewID); 81 85 m_editableImages.remove(embeddedViewID); 82 86 } … … 84 88 void EditableImageController::associateWithAttachment(WebCore::GraphicsLayer::EmbeddedViewID embeddedViewID, const String& attachmentID) 85 89 { 90 MESSAGE_CHECK_VIEWID(embeddedViewID); 86 91 if (!m_webPageProxy) 87 92 return; … … 151 156 } // namespace WebKit 152 157 158 #undef MESSAGE_CHECK_VIEWID 159 153 160 #endif // HAVE(PENCILKIT)
Note:
See TracChangeset
for help on using the changeset viewer.