tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit b60c22aec09d237a0f3211483c14ef30c5d3ef44
parent 0a25e0eedbd74c45c877238e33810c85d0ac273f
Author: Pier Angelo Vendrame <pierov@torproject.org>
Date:   Mon, 20 Feb 2023 16:34:33 +0100

BB 41599: Always return an empty string as network ID

Firefox computes an internal network ID used to detect network changes
and act consequently (e.g., to improve WebSocket UX).
However, there are a few ways to get this internal network ID, so we
patch them out, to be sure any new code will not be able to use them and
possibly link users.

We also sent a patch to Mozilla to seed the internal network ID, to
prevent any accidental leak in the future.
Upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=1817756

Diffstat:
Mnetwerk/system/android/nsAndroidNetworkLinkService.cpp | 4++++
Mnetwerk/system/linux/nsNetworkLinkService.cpp | 4++++
Mnetwerk/system/mac/nsNetworkLinkService.mm | 4++++
Mnetwerk/system/netlink/NetlinkService.cpp | 4++++
Mnetwerk/system/win32/nsNotifyAddrListener.cpp | 4++++
5 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/netwerk/system/android/nsAndroidNetworkLinkService.cpp b/netwerk/system/android/nsAndroidNetworkLinkService.cpp @@ -126,11 +126,15 @@ nsAndroidNetworkLinkService::GetLinkType(uint32_t* aLinkType) { NS_IMETHODIMP nsAndroidNetworkLinkService::GetNetworkID(nsACString& aNetworkID) { +#ifdef BASE_BROWSER_VERSION + aNetworkID.Truncate(); +#else if (!mNetlinkSvc) { return NS_ERROR_NOT_AVAILABLE; } mNetlinkSvc->GetNetworkID(aNetworkID); +#endif return NS_OK; } diff --git a/netwerk/system/linux/nsNetworkLinkService.cpp b/netwerk/system/linux/nsNetworkLinkService.cpp @@ -50,11 +50,15 @@ nsNetworkLinkService::GetLinkType(uint32_t* aLinkType) { NS_IMETHODIMP nsNetworkLinkService::GetNetworkID(nsACString& aNetworkID) { +#ifdef BASE_BROWSER_VERSION + aNetworkID.Truncate(); +#else if (!mNetlinkSvc) { return NS_ERROR_NOT_AVAILABLE; } mNetlinkSvc->GetNetworkID(aNetworkID); +#endif return NS_OK; } diff --git a/netwerk/system/mac/nsNetworkLinkService.mm b/netwerk/system/mac/nsNetworkLinkService.mm @@ -128,8 +128,12 @@ nsNetworkLinkService::GetLinkType(uint32_t* aLinkType) { NS_IMETHODIMP nsNetworkLinkService::GetNetworkID(nsACString& aNetworkID) { +#ifdef BASE_BROWSER_VERSION + aNetworkID.Truncate(); +#else MutexAutoLock lock(mMutex); aNetworkID = mNetworkId; +#endif return NS_OK; } diff --git a/netwerk/system/netlink/NetlinkService.cpp b/netwerk/system/netlink/NetlinkService.cpp @@ -1884,8 +1884,12 @@ void NetlinkService::CalculateNetworkID() { } void NetlinkService::GetNetworkID(nsACString& aNetworkID) { +#ifdef BASE_BROWSER_VERSION + aNetworkID.Truncate(); +#else MutexAutoLock lock(mMutex); aNetworkID = mNetworkId; +#endif } nsresult NetlinkService::GetDnsSuffixList(nsTArray<nsCString>& aDnsSuffixList) { diff --git a/netwerk/system/win32/nsNotifyAddrListener.cpp b/netwerk/system/win32/nsNotifyAddrListener.cpp @@ -110,8 +110,12 @@ nsNotifyAddrListener::GetLinkType(uint32_t* aLinkType) { NS_IMETHODIMP nsNotifyAddrListener::GetNetworkID(nsACString& aNetworkID) { +#ifdef BASE_BROWSER_VERSION + aNetworkID.Truncate(); +#else MutexAutoLock lock(mMutex); aNetworkID = mNetworkId; +#endif return NS_OK; }