[webkit-changes] [WebKit/WebKit] c307e8: [Private Browsing 2.0] Some trackers blocked by li...
Wenson Hsieh
noreply at github.com
Thu Aug 10 15:59:11 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c307e83c5b060b38fc3d3f93ef43fbb6e62c1911
https://github.com/WebKit/WebKit/commit/c307e83c5b060b38fc3d3f93ef43fbb6e62c1911
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-08-10 (Thu, 10 Aug 2023)
Changed paths:
M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
M Source/WebCore/PAL/pal/PlatformMac.cmake
A Source/WebCore/PAL/pal/spi/cocoa/NetworkSPI.h
M Source/WebCore/platform/network/cf/ResourceError.h
M Source/WebCore/platform/network/mac/ResourceErrorMac.mm
M Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
M Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm
M Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm
M Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm
M Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h
M Source/WebKit/Platform/cocoa/WebPrivacyHelpers.mm
R Source/WebKit/Platform/spi/Cocoa/NWSPI.h
M Source/WebKit/WebKit.xcodeproj/project.pbxproj
Log Message:
-----------
[Private Browsing 2.0] Some trackers blocked by libnetcore aren't listed in Privacy Report
https://bugs.webkit.org/show_bug.cgi?id=260024
rdar://112243760
Reviewed by Tim Horton and Matthew Finkel.
Currently, blocked tracking requests in Private Browsing mode are surfaced to Safari through the
navigation delegate method `-_webView:didFailLoadDueToNetworkConnectionIntegrityWithURL:`. Safari
then cross-references these URLs against another dataset of known trackers, and only shows blocked
domains in the Privacy Report UI, if the tracking domain matches one on this list. When blocking
CNAME-cloaked requests, this filtering means that unless the original request URL is itself a
known tracker, Safari will just omit this from the UI.
To fix this, we extract the host name of the endpoint that warranted blocking from libnetcore, and
replace the host name of the reported URL with this name instead: for instance, if "tracker.foo.com"
is a CNAME alias to "tracker.com", we'll report "tracker.com" instead of the original request,
"tracker.foo.com".
No new test, since this would require network request to a URL that's a CNAME alias, and which
mDNSResponder would map to a known tracking domain.
* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:
* Source/WebCore/PAL/pal/PlatformMac.cmake:
* Source/WebCore/PAL/pal/spi/cocoa/NetworkSPI.h: Renamed from Source/WebKit/Platform/spi/Cocoa/NWSPI.h.
Move this header from WebKit into PAL, so we can use it below. We also rename the file to the
(slightly-less-mysterious) `NetworkSPI.h`.
* Source/WebCore/platform/network/cf/ResourceError.h:
(WebCore::ResourceError::blockedKnownTracker const):
(WebCore::ResourceError::blockedTrackerHostName const):
* Source/WebCore/platform/network/mac/ResourceErrorMac.mm:
(extractBlockedTrackerHostName):
Change the `m_blockedKnownTracker` flag to a string: `m_blockedTrackerHostName`. The null string
represents that the request was not blocked.
(WebCore::ResourceError::platformLazyInit):
(failureIsDueToTrackerBlocking): Deleted.
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::didFailLoading):
Use the `blockedTrackerHostName()` above to replace the reported URL's host when reporting the
failing URL to the UI process via `NetworkProcessProxy::DidBlockLoadToKnownTracker`.
* Source/WebKit/NetworkProcess/cocoa/NetworkDataTaskCocoa.mm:
* Source/WebKit/NetworkProcess/webrtc/NetworkRTCTCPSocketCocoa.mm:
* Source/WebKit/NetworkProcess/webrtc/NetworkRTCUDPSocketCocoa.mm:
* Source/WebKit/NetworkProcess/webrtc/NetworkRTCUtilitiesCocoa.h:
* Source/WebKit/Platform/cocoa/WebPrivacyHelpers.mm:
Change `NWSPI.h` imports to `<pal/spi/cocoa/NWSPI.h>`.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Canonical link: https://commits.webkit.org/266789@main
More information about the webkit-changes
mailing list