Commit d29e6920 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by Richard Pospesel
Browse files

Bug 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
parent 8f3ff102
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -125,11 +125,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;
}

+4 −0
Original line number Diff line number Diff line
@@ -49,11 +49,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;
}

+4 −0
Original line number Diff line number Diff line
@@ -123,8 +123,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;
}

+4 −0
Original line number Diff line number Diff line
@@ -1871,8 +1871,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) {
+4 −0
Original line number Diff line number Diff line
@@ -104,8 +104,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;
}