From 062631f538b24d40cf415d1a761dabc9c93562e6 Mon Sep 17 00:00:00 2001 From: Matthew Finkel Date: Thu, 26 Apr 2018 15:17:42 +0000 Subject: [PATCH] Bug 25741 - TBA: Adjust the User Agent String so it doesn't leak Android version --- mobile/android/base/AppConstants.java.in | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in index c9a9777baf131..ecd205fd42947 100644 --- a/mobile/android/base/AppConstants.java.in +++ b/mobile/android/base/AppConstants.java.in @@ -145,20 +145,33 @@ public class AppConstants { public static final String OS_TARGET = "@OS_TARGET@"; public static final String TARGET_XPCOM_ABI = "@TARGET_XPCOM_ABI@"; - public static final String USER_AGENT_BOT_LIKE = "Redirector/" + AppConstants.MOZ_APP_VERSION + - " (Android; rv:" + AppConstants.MOZ_APP_VERSION + ")"; - - public static final String USER_AGENT_FENNEC_MOBILE = "Mozilla/5.0 (Android " + + // TBA: Commented out, not used. + //public static final String USER_AGENT_BOT_LIKE = "Redirector/" + AppConstants.MOZ_APP_VERSION + + // " (Android; rv:" + AppConstants.MOZ_APP_VERSION + ")"; + + // TBA: Fennec's UAS now contains the Android version. Hard-code all users UAS + // so it matches the RFP string from necko. + // toolkit/components/resistfingerprinting/nsRFPService.h + public static final String USER_AGENT_FENNEC_MOBILE = +//#ifdef TOR_BROWSER_VERSION + "Mozilla/5.0 (Android 6.0; Mobile; rv:68.0) Gecko/20100101 Firefox/68.0"; +//#else + "Mozilla/5.0 (Android " + Build.VERSION.RELEASE + "; Mobile; rv:" + AppConstants.MOZ_APP_VERSION + ") Gecko/" + AppConstants.MOZ_APP_VERSION + " Firefox/" + AppConstants.MOZ_APP_VERSION; +//#endif +//#ifdef TOR_BROWSER_VERSION + public static final String USER_AGENT_FENNEC_TABLET = USER_AGENT_FENNEC_MOBILE; +//#else public static final String USER_AGENT_FENNEC_TABLET = "Mozilla/5.0 (Android " + Build.VERSION.RELEASE + "; Tablet; rv:" + AppConstants.MOZ_APP_VERSION + ") Gecko/" + AppConstants.MOZ_APP_VERSION + " Firefox/" + AppConstants.MOZ_APP_VERSION; +//#endif public static final boolean MOZ_ANDROID_ANR_REPORTER = //#ifdef MOZ_ANDROID_ANR_REPORTER -- GitLab