Bug 168975

Summary: [WebRTC] Activate ICE candidate privacy policy
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, commit-queue, eric.carlson, jer.noble
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description youenn fablet 2017-02-28 10:35:51 PST
We should activate ICE candidate privacy policy by default and find a way to disable it when needed.
Comment 1 youenn fablet 2017-02-28 11:35:31 PST
Created attachment 302956 [details]
Patch
Comment 2 youenn fablet 2017-02-28 11:37:02 PST
This patch is a second step towards implementing privacy policy.
We should add tests and probably reactivate filtering in some cases.
For instance when access is being revoked from the address bar.
Comment 3 Eric Carlson 2017-02-28 15:17:09 PST
Comment on attachment 302956 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=302956&action=review

> Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:209
> +#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
> +    m_page.process().send(Messages::WebPage::DisableICECandidateFiltering(), m_page.pageID());
> +#endif

I don't think this should be done here, because it will disable filtering if the user accepts one stream and denies another. Instead, I think it should be in UserMediaProcessManager::willCreateMediaStream and UserMediaProcessManager::endedCaptureSession.
Comment 4 youenn fablet 2017-03-01 09:54:02 PST
Created attachment 303074 [details]
Patch
Comment 5 youenn fablet 2017-03-01 09:56:18 PST
(In reply to comment #3)
> Comment on attachment 302956 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=302956&action=review
> 
> > Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:209
> > +#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
> > +    m_page.process().send(Messages::WebPage::DisableICECandidateFiltering(), m_page.pageID());
> > +#endif
> 
> I don't think this should be done here, because it will disable filtering if
> the user accepts one stream and denies another. Instead, I think it should
> be in UserMediaProcessManager::willCreateMediaStream and
> UserMediaProcessManager::endedCaptureSession.

Thanks for the feedback.
I updated patch accordingly.
I also added a layout test for it.
Comment 6 Eric Carlson 2017-03-01 11:25:56 PST
Comment on attachment 303074 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=303074&action=review

> Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:205
> +#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
> +    m_page.process().send(Messages::WebPage::DisableICECandidateFiltering(), m_page.pageID());
> +#endif

Don't you want to remove this?

> Source/WebKit2/UIProcess/UserMediaProcessManager.cpp:159
> +#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
> +    if (currentExtensions == ProcessState::SandboxExtensionsGranted::None)
> +        proxy.page().process().send(Messages::WebPage::DisableICECandidateFiltering(), proxy.page().pageID());
> +#endif

Shouldn't this be in UserMediaProcessManager::endedCaptureSession?
Comment 7 youenn fablet 2017-03-01 17:05:17 PST
Created attachment 303143 [details]
Patch
Comment 8 youenn fablet 2017-03-01 17:06:23 PST
(In reply to comment #6)
> Comment on attachment 303074 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=303074&action=review
> 
> > Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp:205
> > +#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
> > +    m_page.process().send(Messages::WebPage::DisableICECandidateFiltering(), m_page.pageID());
> > +#endif
> 
> Don't you want to remove this?

Right

> > Source/WebKit2/UIProcess/UserMediaProcessManager.cpp:159
> > +#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
> > +    if (currentExtensions == ProcessState::SandboxExtensionsGranted::None)
> > +        proxy.page().process().send(Messages::WebPage::DisableICECandidateFiltering(), proxy.page().pageID());
> > +#endif
> 
> Shouldn't this be in UserMediaProcessManager::endedCaptureSession?

We want to disable filtering when capture is authorised, so I think this is ok like this. I reworked a bit the way this is handled to ensure we got good coverage here.
Comment 9 youenn fablet 2017-03-01 17:08:41 PST
Eric, could you check that the granting/revocation goes well with the disable/enable filtering?
Alex, one thing to consider is that we probably do not want these preferences to stay persistent WebKit launch after WebKit launch. Maybe more a Safari issue though but this may be the two-only preferences that act like this currently.
Comment 10 WebKit Commit Bot 2017-03-02 08:23:27 PST
Comment on attachment 303143 [details]
Patch

Clearing flags on attachment: 303143

Committed r213283: <http://trac.webkit.org/changeset/213283>
Comment 11 WebKit Commit Bot 2017-03-02 08:23:31 PST
All reviewed patches have been landed.  Closing bug.