Remove sensitive information from crash and feedback reports

This commit is contained in:
Torsten Grote
2016-08-23 17:28:09 -03:00
parent 8b56e082b3
commit cc7602e566
2 changed files with 38 additions and 6 deletions

View File

@@ -14,6 +14,25 @@ import org.briarproject.android.report.DevReportActivity;
import java.util.logging.Logger;
import static org.acra.ReportField.ANDROID_VERSION;
import static org.acra.ReportField.APP_VERSION_CODE;
import static org.acra.ReportField.APP_VERSION_NAME;
import static org.acra.ReportField.BRAND;
import static org.acra.ReportField.BUILD_CONFIG;
import static org.acra.ReportField.CRASH_CONFIGURATION;
import static org.acra.ReportField.CUSTOM_DATA;
import static org.acra.ReportField.DEVICE_FEATURES;
import static org.acra.ReportField.DISPLAY;
import static org.acra.ReportField.INITIAL_CONFIGURATION;
import static org.acra.ReportField.LOGCAT;
import static org.acra.ReportField.PACKAGE_NAME;
import static org.acra.ReportField.PHONE_MODEL;
import static org.acra.ReportField.PRODUCT;
import static org.acra.ReportField.REPORT_ID;
import static org.acra.ReportField.STACK_TRACE;
import static org.acra.ReportField.USER_APP_START_DATE;
import static org.acra.ReportField.USER_CRASH_DATE;
@ReportsCrashes(
reportPrimerClass = BriarReportPrimer.class,
logcatArguments = {"-d", "-v", "time", "*:I"},
@@ -21,7 +40,19 @@ import java.util.logging.Logger;
mode = ReportingInteractionMode.DIALOG,
reportDialogClass = DevReportActivity.class,
resDialogOkToast = R.string.dev_report_saved,
deleteOldUnsentReportsOnApplicationStart = false
deleteOldUnsentReportsOnApplicationStart = false,
customReportContent = {
REPORT_ID,
APP_VERSION_CODE, APP_VERSION_NAME, PACKAGE_NAME,
PHONE_MODEL, ANDROID_VERSION, BRAND, PRODUCT,
BUILD_CONFIG,
CUSTOM_DATA,
STACK_TRACE,
INITIAL_CONFIGURATION, CRASH_CONFIGURATION,
DISPLAY, DEVICE_FEATURES,
USER_APP_START_DATE, USER_CRASH_DATE,
LOGCAT
}
)
public class BriarApplicationImpl extends Application
implements BriarApplication {

View File

@@ -36,6 +36,7 @@ import static android.content.Context.WIFI_SERVICE;
import static android.net.ConnectivityManager.TYPE_MOBILE;
import static android.net.ConnectivityManager.TYPE_WIFI;
import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED;
import static org.briarproject.util.StringUtils.scrubMacAddress;
public class BriarReportPrimer implements ReportPrimer {
@@ -165,10 +166,8 @@ public class BriarReportPrimer implements ReportPrimer {
if (wifiInfo != null) {
int ip = wifiInfo.getIpAddress(); // Nice API, Google
int ip1 = ip & 0xFF;
int ip2 = (ip >> 8) & 0xFF;
int ip3 = (ip >> 16) & 0xFF;
int ip4 = (ip >> 24) & 0xFF;
String address = ip1 + "." + ip2 + "." + ip3 + "." + ip4;
String address = ip1 + ".[scrubbed]." + ip4;
customData.put("Wi-Fi address", address);
}
}
@@ -200,7 +199,8 @@ public class BriarReportPrimer implements ReportPrimer {
customData.put("Bluetooth status", btStatus);
if (bt != null)
customData.put("Bluetooth address", bt.getAddress());
customData.put("Bluetooth address",
scrubMacAddress(bt.getAddress()));
String btSettingsAddr;
try {
btSettingsAddr = Settings.Secure.getString(
@@ -208,7 +208,8 @@ public class BriarReportPrimer implements ReportPrimer {
} catch (SecurityException e) {
btSettingsAddr = "Could not get address from settings";
}
customData.put("Bluetooth address from settings", btSettingsAddr);
customData.put("Bluetooth address from settings",
scrubMacAddress(btSettingsAddr));
return Collections.unmodifiableMap(customData);
}