← All reports

[Site Isolation] Find-in-page scroll propagation through cross-site iframes

Component: WebKit Site Isolation | ab06c21

Source/WebKit/UIProcess/WebFrameProxy.cpp

+void WebFrameProxy::scrollRectToVisibleContinuingFromFrame(WebCore::FrameIdentifier childFrameID, const WebCore::IntRect& rectInChildFrameView, const WebCore::ScrollRectToVisibleOptions& options)
+{
+ RefPtr childFrame = WebFrameProxy::webFrame(childFrameID);
+ if (!childFrame || childFrame->parentFrame() != this)
+ return;
+ send(Messages::WebFrame::ScrollRectToVisibleContinuingFromFrame(childFrameID, rectInChildFrameView, options));
+}

Source/WebCore/page/LocalFrameView.cpp

+void LocalFrameView::scrollRectToVisibleContinuingFromChildFrame(Frame& childFrame, const IntRect& rectInChildFrameView, const ScrollRectToVisibleOptions& options)
+{
+ if (childFrame.tree().parent() != m_frame.ptr())
+ return;
+ ...
+ auto rectInContents = viewToContents(childView->convertToContainingView(rectInChildFrameView));
+ scrollRectToVisible(rectInContents, *ownerRenderer, false /* insideFixed */, options);
+}

FrameSelection::revealSelection()은 보통 각 <iframe>의 owner renderer를 따라 위로 올라가면서 대상을 화면에 드러냅니다. 그런데 site isolation 환경의 cross-site child frame은 자기 process 안에 owner element를 갖고 있지 않습니다. 그래서 이 탐색이 child 단계에서 멈췄습니다.

이번 변경으로, child의 parent가 RemoteFrame이면 child가 자신의 view 좌표 기준 rect를 WebFrameProxy로 전송하도록 수정되었습니다. 이때 새로 serialization이 추가된 ScrollRectToVisibleOptions도 함께 전달됩니다. UI process는 지정된 child의 parent가 대상 proxy인지 확인한 뒤, 요청을 parent process로 넘깁니다. 이어서 parent는 rect를 변환해 owner renderer에서 scroll을 수행하며, 이 relay는 main frame에 도달할 때까지 반복됩니다.

Cross-site iframe 내부의 find-in-page 결과가 이제 상위 embedding page의 scroll까지 이어집니다. 다만 그 대가로, renderer가 제어하는 geometry와 scroll option을 운반하는 WebContent → UI → WebContent relay가 새로 추가되었습니다.

UI process의 검사는 childFrameID의 parent가 이 proxy인지만 확인합니다. 해당 connection이 그 child를 호스팅하는 process에 속하는지는 확인하지 않습니다. 따라서 compromised process가 sibling frame의 ID를 지정할 가능성이 있습니다.

먼저 요청이 처리되는 도중 frame이 detach되거나, reparent되거나, 다른 process로 이동하는 경우를 살펴볼 필요가 있습니다. 이때 scrollRectToVisibleContinuingFromChildFrame()이 frame 관계를 어떻게 재검증하는지가 핵심입니다.

convertToContainingView(), viewToContents(), LayoutUnit 변환에는 극단적인 rect 값을 넣어 점검해 볼 만합니다. 새로 추가된 ScrollTypes.serialization.in 항목에 검증되지 않은 enum이나 optional이 있는지도 확인해야 합니다.

한편 scrollRectToVisible()은 layout과 scroll event를 유발할 수 있습니다. 그래서 owner element, CheckedPtr renderer, child view가 그 이후에도 유효한 상태로 남는지 검증이 필요합니다. 리팩터링된 scrollRectToVisibleInChildView()는 이제 null ownerElement를 허용하므로, 다른 코드에서 이 값을 무조건 dereference하는 지점이 없는지도 확인해야 합니다.

마지막으로 multi-hop 전파는 hop마다 비동기로 진행됩니다. 결과적으로 hop 사이에 frame tree가 변경되는 경우와 message amplification 문제를 함께 따져볼 여지가 있습니다.