Commit 0fb56325 authored by morgan's avatar morgan 😸
Browse files

fixup! MB 234: Disable OS spoofing in HTTP User-Agent.

parent 453f6361
Loading
Loading
Loading
Loading
+0 −3
Changes for browser/app/profile/000-mullvad-browser.js: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -45,6 +45,3 @@ pref("app.releaseNotesURL", "https://github.com/mullvad/mullvad-browser/releases
pref("app.releaseNotesURL.aboutDialog", "about:blank");
// point to our feedback url rather than Mozilla's
pref("app.feedback.baseURL", "https://mullvad.net/help/tag/browser/");

// mullvad-browser#234: Do not spoof the OS in the User-Agent header
pref("privacy.resistFingerprinting.spoofOsInUserAgentHeader", false);
+0 −11
Changes for netwerk/protocol/http/nsHttpHandler.cpp: 0 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -482,9 +482,6 @@ nsresult nsHttpHandler::Init() {
    // obsService->AddObserver(this, "net:failed-to-process-uri-content", true);
  }

  Preferences::AddWeakObserver(
      this, "privacy.resistFingerprinting.spoofOsInUserAgentHeader"_ns);

  MakeNewRequestTokenBucket();
  mWifiTickler = new Tickler();
  if (NS_FAILED(mWifiTickler->Init())) mWifiTickler = nullptr;
@@ -2108,9 +2105,6 @@ nsHttpHandler::Observe(nsISupports* subject, const char* topic,
    // Inform nsIOService that network is tearing down.
    gIOService->SetHttpHandlerAlreadyShutingDown();

    Preferences::RemoveObserver(
        this, "privacy.resistFingerprinting.spoofOsInUserAgentHeader"_ns);

    ShutdownConnectionManager();

    // need to reset the session start time since cache validation may
@@ -2233,11 +2227,6 @@ nsHttpHandler::Observe(nsISupports* subject, const char* topic,
    ShutdownConnectionManager();
    mConnMgr = nullptr;
    Unused << InitConnectionMgr();
  } else if (!strcmp(topic, "nsPref:changed") &&
             !NS_strcmp(
                 data,
                 u"privacy.resistFingerprinting.spoofOsInUserAgentHeader")) {
    nsRFPService::GetSpoofedUserAgent(mSpoofedUserAgent, true);
  }

  return NS_OK;
+2 −7
Changes for toolkit/components/resistfingerprinting/nsRFPService.cpp: 2 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -904,16 +904,11 @@ void nsRFPService::GetSpoofedUserAgent(nsACString& userAgent,
  // https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/userAgent
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent

  const bool spoofOs =
      isForHTTPHeader &&
      Preferences::GetBool(
          "privacy.resistFingerprinting.spoofOsInUserAgentHeader", true);

  // These magic numbers are the lengths of the UA string literals below.
  // Assume three-digit Firefox version numbers so we have room to grow.
  size_t preallocatedLength =
      13 +
      (spoofOs ? mozilla::ArrayLength(SPOOFED_HTTP_UA_OS)
      (isForHTTPHeader ? mozilla::ArrayLength(SPOOFED_HTTP_UA_OS)
                       : mozilla::ArrayLength(SPOOFED_UA_OS)) -
      1 + 5 + 3 + 10 + mozilla::ArrayLength(LEGACY_UA_GECKO_TRAIL) - 1 + 9 + 3 +
      2;
@@ -922,7 +917,7 @@ void nsRFPService::GetSpoofedUserAgent(nsACString& userAgent,
  // "Mozilla/5.0 (%s; rv:%d.0) Gecko/%d Firefox/%d.0"
  userAgent.AssignLiteral("Mozilla/5.0 (");

  if (spoofOs) {
  if (isForHTTPHeader) {
    userAgent.AppendLiteral(SPOOFED_HTTP_UA_OS);
  } else {
    userAgent.AppendLiteral(SPOOFED_UA_OS);