Changeset 213283 in webkit


Ignore:
Timestamp:
Mar 2, 2017 8:24:30 AM (7 years ago)
Author:
commit-queue@webkit.org
Message:

[WebRTC] Activate ICE candidate privacy policy
https://bugs.webkit.org/show_bug.cgi?id=168975

Patch by Youenn Fablet <youenn@apple.com> on 2017-03-02
Reviewed by Alex Christensen.

Source/WebCore:

Test: webrtc/datachannel/filter-ice-candidate.html

  • testing/Internals.cpp:

(WebCore::Internals::Internals): Disabling ICE candidate filtering by default for rwt.
(WebCore::Internals::setICECandidateFiltering):

  • testing/Internals.h:
  • testing/Internals.idl:

Source/WebKit/mac:

  • WebView/WebPreferenceKeysPrivate.h:
  • WebView/WebPreferences.mm:

(-[WebPreferences enumeratingAllNetworkInterfacesEnabled]):
(-[WebPreferences setEnumeratingAllNetworkInterfacesEnabled:]):
(-[WebPreferences iceCandidateFilteringEnabled]):
(-[WebPreferences setIceCandidateFilteringEnabled:]):

  • WebView/WebPreferencesPrivate.h:

Source/WebKit2:

Disabling network enumeration by default.
Enabling ICE candidate filtering by default.
Chaning ICE candidate filtering according userMediaAccess policy:

  • If access is denied, filtering is on.
  • If access is granted, filtering is off.
  • Shared/WebPageCreationParameters.cpp:

(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode):

  • Shared/WebPageCreationParameters.h:
  • Shared/WebPreferencesDefinitions.h:
  • UIProcess/API/C/WKPreferences.cpp:

(WKPreferencesSetICECandidateFilteringEnabled):
(WKPreferencesGetICECandidateFilteringEnabled):
(WKPreferencesSetEnumeratingAllNetworkInterfacesEnabled):
(WKPreferencesGetEnumeratingAllNetworkInterfacesEnabled):

  • UIProcess/API/C/WKPreferencesRefPrivate.h:
  • UIProcess/UserMediaPermissionRequestManagerProxy.cpp:

(WebKit::toWebCore):
(WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):

  • UIProcess/UserMediaProcessManager.cpp:

(WebKit::UserMediaProcessManager::willCreateMediaStream):
(WebKit::UserMediaProcessManager::endedCaptureSession):

  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::creationParameters):

  • WebProcess/WebPage/WebPage.cpp:

LayoutTests:

  • webrtc/datachannel/filter-ice-candidate-expected.txt: Added.
  • webrtc/datachannel/filter-ice-candidate.html: Added.
Location:
trunk
Files:
2 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r213282 r213283  
     12017-03-02  Youenn Fablet  <youenn@apple.com>
     2
     3        [WebRTC] Activate ICE candidate privacy policy
     4        https://bugs.webkit.org/show_bug.cgi?id=168975
     5
     6        Reviewed by Alex Christensen.
     7
     8        * webrtc/datachannel/filter-ice-candidate-expected.txt: Added.
     9        * webrtc/datachannel/filter-ice-candidate.html: Added.
     10
    1112017-03-02  Youenn Fablet  <youenn@apple.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r213281 r213283  
     12017-03-02  Youenn Fablet  <youenn@apple.com>
     2
     3        [WebRTC] Activate ICE candidate privacy policy
     4        https://bugs.webkit.org/show_bug.cgi?id=168975
     5
     6        Reviewed by Alex Christensen.
     7
     8        Test: webrtc/datachannel/filter-ice-candidate.html
     9
     10        * testing/Internals.cpp:
     11        (WebCore::Internals::Internals): Disabling ICE candidate filtering by default for rwt.
     12        (WebCore::Internals::setICECandidateFiltering):
     13        * testing/Internals.h:
     14        * testing/Internals.idl:
     15
    1162017-03-02  Eric Carlson  <eric.carlson@apple.com>
    217
  • trunk/Source/WebCore/testing/Internals.cpp

    r213234 r213283  
    461461    enableMockMediaEndpoint();
    462462    useMockRTCPeerConnectionFactory(String());
     463#if USE(LIBWEBRTC)
     464    if (document.page()) {
     465        document.page()->libWebRTCProvider().enableEnumeratingAllNetworkInterfaces();
     466        document.page()->rtcController().disableICECandidateFiltering();
     467    }
     468#endif
    463469#endif
    464470
     
    11651171    UNUSED_PARAM(testCase);
    11661172#endif
     1173}
     1174
     1175void Internals::setICECandidateFiltering(bool enabled)
     1176{
     1177    Document* document = contextDocument();
     1178    auto* page = document->page();
     1179    if (!page)
     1180        return;
     1181    auto& rtcController = page->rtcController();
     1182    if (enabled)
     1183        rtcController.enableICECandidateFiltering();
     1184    else
     1185        rtcController.disableICECandidateFiltering();
    11671186}
    11681187
  • trunk/Source/WebCore/testing/Internals.h

    r213234 r213283  
    399399    void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection&, const String& action);
    400400    void useMockRTCPeerConnectionFactory(const String&);
     401    void setICECandidateFiltering(bool);
    401402#endif
    402403
  • trunk/Source/WebCore/testing/Internals.idl

    r213169 r213283  
    442442    [Conditional=WIRELESS_PLAYBACK_TARGET, MayThrowException] void setMockMediaPlaybackTargetPickerState(DOMString deviceName, DOMString deviceState);
    443443    [Conditional=MEDIA_STREAM] void setMockMediaCaptureDevicesEnabled(boolean enabled);
     444
    444445    [Conditional=WEB_RTC] void emulateRTCPeerConnectionPlatformEvent(RTCPeerConnection connection, DOMString action);
    445446    [Conditional=WEB_RTC] void useMockRTCPeerConnectionFactory(DOMString testCase);
     447    [Conditional=WEB_RTC] void setICECandidateFiltering(boolean enabled);
    446448
    447449    [Conditional=VIDEO] void simulateSystemSleep();
  • trunk/Source/WebKit/mac/ChangeLog

    r213260 r213283  
     12017-03-02  Youenn Fablet  <youenn@apple.com>
     2
     3        [WebRTC] Activate ICE candidate privacy policy
     4        https://bugs.webkit.org/show_bug.cgi?id=168975
     5
     6        Reviewed by Alex Christensen.
     7
     8        * WebView/WebPreferenceKeysPrivate.h:
     9        * WebView/WebPreferences.mm:
     10        (-[WebPreferences enumeratingAllNetworkInterfacesEnabled]):
     11        (-[WebPreferences setEnumeratingAllNetworkInterfacesEnabled:]):
     12        (-[WebPreferences iceCandidateFilteringEnabled]):
     13        (-[WebPreferences setIceCandidateFilteringEnabled:]):
     14        * WebView/WebPreferencesPrivate.h:
     15
    1162017-03-01  Alex Christensen  <achristensen@webkit.org>
    217
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r212776 r213283  
    222222#define WebKitMediaDataLoadsAutomaticallyPreferenceKey @"WebKitMediaDataLoadsAutomatically"
    223223#define WebKitMockCaptureDevicesEnabledPreferenceKey @"WebKitMockCaptureDevicesEnabled"
     224#define WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey @"WebKitEnumeratingAllNetworkInterfacesEnabled"
     225#define WebKitICECandidateFilteringEnabledPreferenceKey @"WebKitICECandidateFilteringEnabled"
    224226#define WebKitMediaCaptureRequiresSecureConnectionPreferenceKey @"WebKitMediaCaptureRequiresSecureConnection"
    225227#define WebKitAttachmentElementEnabledPreferenceKey @"WebKitAttachmentElementEnabled"
  • trunk/Source/WebKit/mac/WebView/WebPreferences.mm

    r212776 r213283  
    28352835}
    28362836
     2837- (BOOL)enumeratingAllNetworkInterfacesEnabled
     2838{
     2839    return [self _boolValueForKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
     2840}
     2841
     2842- (void)setEnumeratingAllNetworkInterfacesEnabled:(BOOL)flag
     2843{
     2844    [self _setBoolValue:flag forKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
     2845}
     2846
     2847- (BOOL)iceCandidateFilteringEnabled
     2848{
     2849    return [self _boolValueForKey:WebKitICECandidateFilteringEnabledPreferenceKey];
     2850}
     2851
     2852- (void)setIceCandidateFilteringEnabled:(BOOL)flag
     2853{
     2854    [self _setBoolValue:flag forKey:WebKitICECandidateFilteringEnabledPreferenceKey];
     2855}
     2856
    28372857- (BOOL)mediaCaptureRequiresSecureConnection
    28382858{
  • trunk/Source/WebKit/mac/WebView/WebPreferencesPrivate.h

    r212776 r213283  
    497497- (BOOL)mockCaptureDevicesEnabled;
    498498
     499- (void)setEnumeratingAllNetworkInterfacesEnabled:(BOOL)flag;
     500- (BOOL)enumeratingAllNetworkInterfacesEnabled;
     501
     502- (void)setIceCandidateFilteringEnabled:(BOOL)flag;
     503- (BOOL)iceCandidateFilteringEnabled;
     504
    499505- (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag;
    500506- (BOOL)mediaCaptureRequiresSecureConnection;
  • trunk/Source/WebKit2/ChangeLog

    r213278 r213283  
     12017-03-02  Youenn Fablet  <youenn@apple.com>
     2
     3        [WebRTC] Activate ICE candidate privacy policy
     4        https://bugs.webkit.org/show_bug.cgi?id=168975
     5
     6        Reviewed by Alex Christensen.
     7
     8        Disabling network enumeration by default.
     9        Enabling ICE candidate filtering by default.
     10        Chaning ICE candidate filtering according userMediaAccess policy:
     11        - If access is denied, filtering is on.
     12        - If access is granted, filtering is off.
     13
     14        * Shared/WebPageCreationParameters.cpp:
     15        (WebKit::WebPageCreationParameters::encode):
     16        (WebKit::WebPageCreationParameters::decode):
     17        * Shared/WebPageCreationParameters.h:
     18        * Shared/WebPreferencesDefinitions.h:
     19        * UIProcess/API/C/WKPreferences.cpp:
     20        (WKPreferencesSetICECandidateFilteringEnabled):
     21        (WKPreferencesGetICECandidateFilteringEnabled):
     22        (WKPreferencesSetEnumeratingAllNetworkInterfacesEnabled):
     23        (WKPreferencesGetEnumeratingAllNetworkInterfacesEnabled):
     24        * UIProcess/API/C/WKPreferencesRefPrivate.h:
     25        * UIProcess/UserMediaPermissionRequestManagerProxy.cpp:
     26        (WebKit::toWebCore):
     27        (WebKit::UserMediaPermissionRequestManagerProxy::userMediaAccessWasGranted):
     28        * UIProcess/UserMediaProcessManager.cpp:
     29        (WebKit::UserMediaProcessManager::willCreateMediaStream):
     30        (WebKit::UserMediaProcessManager::endedCaptureSession):
     31        * UIProcess/WebPageProxy.cpp:
     32        (WebKit::WebPageProxy::creationParameters):
     33        * WebProcess/WebPage/WebPage.cpp:
     34
    1352017-03-02  Tomas Popela  <tpopela@redhat.com>
    236
  • trunk/Source/WebKit2/Shared/WebPageCreationParameters.cpp

    r213012 r213283  
    9595    encoder << overrideContentSecurityPolicy;
    9696#if ENABLE(WEB_RTC)
    97     encoder << disableICECandidateFiltering;
     97    encoder << iceCandidateFilteringEnabled;
    9898#if USE(LIBWEBRTC)
    99     encoder << enableEnumeratingAllNetworkInterfaces;
     99    encoder << enumeratingAllNetworkInterfacesEnabled;
    100100#endif
    101101#endif
     
    223223
    224224#if ENABLE(WEB_RTC)
    225     if (!decoder.decode(parameters.disableICECandidateFiltering))
     225    if (!decoder.decode(parameters.iceCandidateFilteringEnabled))
    226226        return false;
    227227#if USE(LIBWEBRTC)
    228     if (!decoder.decode(parameters.enableEnumeratingAllNetworkInterfaces))
     228    if (!decoder.decode(parameters.enumeratingAllNetworkInterfacesEnabled))
    229229        return false;
    230230#endif
  • trunk/Source/WebKit2/Shared/WebPageCreationParameters.h

    r212745 r213283  
    148148
    149149#if ENABLE(WEB_RTC)
    150     bool disableICECandidateFiltering { false };
     150    bool iceCandidateFilteringEnabled { true };
    151151#if USE(LIBWEBRTC)
    152     bool enableEnumeratingAllNetworkInterfaces { false };
     152    bool enumeratingAllNetworkInterfacesEnabled { false };
    153153#endif
    154154#endif
  • trunk/Source/WebKit2/Shared/WebPreferencesDefinitions.h

    r213221 r213283  
    226226    macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
    227227    macro(MediaCaptureRequiresSecureConnection, mediaCaptureRequiresSecureConnection, Bool, bool, true, "", "") \
     228    macro(EnumeratingAllNetworkInterfacesEnabled, enumeratingAllNetworkInterfacesEnabled, Bool, bool, false, "", "") \
     229    macro(ICECandidateFilteringEnabled, iceCandidateFilteringEnabled, Bool, bool, true, "", "") \
    228230    macro(ShadowDOMEnabled, shadowDOMEnabled, Bool, bool, true, "Shadow DOM", "HTML Shadow DOM prototype") \
    229231    macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, true, "", "") \
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferences.cpp

    r212776 r213283  
    15421542}
    15431543
     1544void WKPreferencesSetICECandidateFilteringEnabled(WKPreferencesRef preferencesRef, bool enabled)
     1545{
     1546    toImpl(preferencesRef)->setICECandidateFilteringEnabled(enabled);
     1547}
     1548
     1549bool WKPreferencesGetICECandidateFilteringEnabled(WKPreferencesRef preferencesRef)
     1550{
     1551    return toImpl(preferencesRef)->iceCandidateFilteringEnabled();
     1552}
     1553
     1554void WKPreferencesSetEnumeratingAllNetworkInterfacesEnabled(WKPreferencesRef preferencesRef, bool enabled)
     1555{
     1556    toImpl(preferencesRef)->setEnumeratingAllNetworkInterfacesEnabled(enabled);
     1557}
     1558
     1559bool WKPreferencesGetEnumeratingAllNetworkInterfacesEnabled(WKPreferencesRef preferencesRef)
     1560{
     1561    return toImpl(preferencesRef)->enumeratingAllNetworkInterfacesEnabled();
     1562}
     1563
    15441564void WKPreferencesSetMediaCaptureRequiresSecureConnection(WKPreferencesRef preferencesRef, bool enabled)
    15451565{
  • trunk/Source/WebKit2/UIProcess/API/C/WKPreferencesRefPrivate.h

    r213015 r213283  
    423423
    424424// Defaults to true.
     425WK_EXPORT void WKPreferencesSetICECandidateFilteringEnabled(WKPreferencesRef, bool);
     426WK_EXPORT bool WKPreferencesGetICECandidateFilteringEnabled(WKPreferencesRef);
     427
     428// Defaults to false.
     429WK_EXPORT void WKPreferencesSetEnumeratingAllNetworkInterfacesEnabled(WKPreferencesRef, bool);
     430WK_EXPORT bool WKPreferencesGetEnumeratingAllNetworkInterfacesEnabled(WKPreferencesRef);
     431
     432// Defaults to true.
    425433WK_EXPORT void WKPreferencesSetMediaCaptureRequiresSecureConnection(WKPreferencesRef, bool);
    426434WK_EXPORT bool WKPreferencesGetMediaCaptureRequiresSecureConnection(WKPreferencesRef);
  • trunk/Source/WebKit2/UIProcess/UserMediaPermissionRequestManagerProxy.cpp

    r209512 r213283  
    158158        break;
    159159    }
    160    
     160
    161161    ASSERT_NOT_REACHED();
    162162    return static_cast<uint64_t>(UserMediaRequest::MediaAccessDenialReason::OtherFailure);
  • trunk/Source/WebKit2/UIProcess/UserMediaProcessManager.cpp

    r210097 r213283  
    129129
    130130    unsigned currentExtensions = state.sandboxExtensionsGranted();
     131
     132#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
     133    if (currentExtensions == ProcessState::SandboxExtensionsGranted::None && (withAudio || withVideo))
     134        proxy.page().process().send(Messages::WebPage::DisableICECandidateFiltering(), proxy.page().pageID());
     135#endif
     136
    131137    if (!(requiredExtensions & currentExtensions)) {
    132138        SandboxExtension::HandleArray handles;
     
    193199        return;
    194200
     201#if ENABLE(WEB_RTC) && USE(LIBWEBRTC)
     202    if (currentExtensions == ProcessState::SandboxExtensionsGranted::None && proxy.page().preferences().iceCandidateFilteringEnabled())
     203        proxy.page().process().send(Messages::WebPage::EnableICECandidateFiltering(), proxy.page().pageID());
     204#endif
     205
    195206    state.setSandboxExtensionsGranted(currentExtensions);
    196207    proxy.page().process().send(Messages::WebPage::RevokeUserMediaDeviceSandboxExtensions(params), proxy.page().pageID());
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r213278 r213283  
    55725572
    55735573#if ENABLE(WEB_RTC)
    5574     // FIXME: We should tie ICE filtering with getUserMedia permission.
    5575     parameters.disableICECandidateFiltering = true;
     5574    parameters.iceCandidateFilteringEnabled = m_preferences->iceCandidateFilteringEnabled();
    55765575#if USE(LIBWEBRTC)
    5577     // FIXME: Turn down network interface enumeration by default.
    5578     parameters.enableEnumeratingAllNetworkInterfaces = true;
     5576    parameters.enumeratingAllNetworkInterfacesEnabled = m_preferences->enumeratingAllNetworkInterfacesEnabled();
    55795577#endif
    55805578#endif
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r213278 r213283  
    554554
    555555#if ENABLE(WEB_RTC)
    556     if (parameters.disableICECandidateFiltering)
     556    if (!parameters.iceCandidateFilteringEnabled)
    557557        disableICECandidateFiltering();
    558558#if USE(LIBWEBRTC)
    559     if (parameters.enableEnumeratingAllNetworkInterfaces)
     559    if (parameters.enumeratingAllNetworkInterfacesEnabled)
    560560        enableEnumeratingAllNetworkInterfaces();
    561561#endif
Note: See TracChangeset for help on using the changeset viewer.