[Site Isolation] Fake mouse-move forwarding into cross-origin iframes
Component: WebKit Site Isolation | ec7db19
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
WebKit은 scroll이나 layout 변경이 일어난 뒤 mouse-move event를 합성합니다. pointer가 움직이지 않는 상태에서도 :hover 상태를 올바르게 유지하기 위해서이며, 이 처리는 EventHandler의 timer가 담당합니다. 다만 site isolation 환경에서는 cross-origin iframe이 parent process 안에 RemoteFrame이라는 대리 객체로만 존재합니다. 그래서 parent가 event를 직접 전달할 수 없고, UI process가 이를 중계해야 합니다.
이를 위해 DispatchFakeMouseMoveEventInRemoteFrame message가 새로 추가되었습니다. 이 message는 대상 FrameIdentifier, 변환된 좌표, global 좌표를 WebPageProxy로 전달합니다. proxy는 먼저 해당 frame이 이 page에 속하는지, 그리고 그 parent frame이 송신 process에서 hosting되고 있는지 확인합니다. 검사를 통과하면 WebPage::DispatchFakeMouseMoveEventInFrame을 frame을 소유한 process로 relay합니다.
Significance
cursor가 멈춘 상태로 cross-origin iframe 위를 scroll할 때 hover가 갱신되지 않던 문제가 수정되었습니다. 동시에 renderer가 발신하고 다른 WebContent process에 도달하는 message가 새로 추가되었습니다.
Audit directions
UI process 측 검사는 경계 상태에 있는 frame을 대상으로 시험해 볼 필요가 있습니다. navigation 도중인 frame, process 간에 교체된 frame, 그리고 process()가 committed frame과 다른 provisional frame이 대표적입니다.
한편 송신 측과 수신 측 어느 쪽도 eventPoint나 globalPoint를 검증하지 않습니다. 따라서 parent frame process가 compromise된 경우, NaN, infinity, 비정상적으로 큰 값이 victim process로 그대로 전달됩니다. 이 값은 timer, hit testing, 좌표 변환 로직까지 도달합니다. 이후 timer는 MouseEventInputSource::UserDriven 속성의 합성 move event를 생성합니다. 결과적으로 compromise된 parent가 cross-origin iframe의 hover, cursor 상태, event timing에 영향을 줄 수 있습니다.
gating이 비대칭이라는 점도 눈여겨볼 만합니다. UI process 측 message는 EnabledBy=SiteIsolationEnabled로 제한되어 있지만, WebPage.messages.in의 receiver에는 EnabledBy attribute가 없습니다. 그 밖에 receiver의 local frame 검사 시점과 지연 실행되는 timer 사이에서 frame 상태가 어떻게 변하는지도 점검해야 합니다. RefPtr 조회와 sendToProcessContainingFrame 호출 사이의 lifetime 역시 살펴볼 필요가 있습니다.