mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Merge branch '311-audit-crash-report-and-feedback-fields-for-sensitive-or-identifying-information' into 'master'
Remove sensitive information from crash and feedback reports This depends on MR !290 and removes also the crash report settings. Closes #311 See merge request !291
This commit is contained in:
@@ -303,12 +303,7 @@
|
||||
<string name="notify_sound_setting_disabled">None</string>
|
||||
<string name="choose_ringtone_title">Choose ringtone</string>
|
||||
|
||||
<!-- Settings Crash reports and feedback -->
|
||||
<string name="crash_report_settings_title">Crash reports</string>
|
||||
<string name="enable_acra_setting">Enable crash reporter</string>
|
||||
<string name="acra_syslog_setting">Send system logs</string>
|
||||
<string name="acra_user_email_setting">Optional contact email</string>
|
||||
<string name="acra_alwaysaccept_setting">Always send reports</string>
|
||||
<!-- Settings Feedback -->
|
||||
<string name="feedback_settings_title">Feedback</string>
|
||||
<string name="send_feedback">Send feedback</string>
|
||||
|
||||
|
||||
@@ -87,35 +87,6 @@
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/crash_report_settings_title">
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:key="acra.enable"
|
||||
android:title="@string/enable_acra_setting"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="true"
|
||||
android:dependency="acra.enable"
|
||||
android:key="acra.syslog.enable"
|
||||
android:title="@string/acra_syslog_setting"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:dependency="acra.enable"
|
||||
android:key="acra.user.email"
|
||||
android:inputType="textEmailAddress"
|
||||
android:summary=""
|
||||
android:title="@string/acra_user_email_setting"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:defaultValue="false"
|
||||
android:dependency="acra.enable"
|
||||
android:key="acra.alwaysaccept"
|
||||
android:title="@string/acra_alwaysaccept_setting"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/feedback_settings_title">
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.PrivacyUtils.scrubMacAddress;
|
||||
|
||||
public class BriarReportPrimer implements ReportPrimer {
|
||||
|
||||
@@ -200,7 +201,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 +210,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);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.briarproject.android.report;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
@@ -20,12 +19,10 @@ import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ReportField;
|
||||
import org.acra.collector.CrashReportData;
|
||||
import org.acra.dialog.BaseCrashReportDialog;
|
||||
import org.acra.file.CrashReportPersister;
|
||||
import org.acra.prefs.SharedPreferencesFactory;
|
||||
import org.briarproject.R;
|
||||
import org.briarproject.android.util.UserFeedback;
|
||||
|
||||
@@ -55,7 +52,6 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(DevReportActivity.class.getName());
|
||||
|
||||
private static final String PREF_EXCLUDED_FIELDS = "excludedReportFields";
|
||||
private static final String STATE_REVIEWING = "reviewing";
|
||||
private static final Set<ReportField> requiredFields = new HashSet<>();
|
||||
|
||||
@@ -69,8 +65,7 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
}
|
||||
|
||||
private AppCompatDelegate delegate;
|
||||
private SharedPreferencesFactory sharedPreferencesFactory;
|
||||
private Set<ReportField> excludedFields;
|
||||
private Set<ReportField> excludedFields = new HashSet<>();
|
||||
private EditText userCommentView = null;
|
||||
private EditText userEmailView = null;
|
||||
private CheckBox includeDebugReport = null;
|
||||
@@ -95,16 +90,6 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
|
||||
getDelegate().setContentView(R.layout.activity_dev_report);
|
||||
|
||||
sharedPreferencesFactory = new SharedPreferencesFactory(
|
||||
getApplicationContext(), getConfig());
|
||||
|
||||
SharedPreferences prefs = sharedPreferencesFactory.create();
|
||||
excludedFields = new HashSet<>();
|
||||
for (String name : prefs.getStringSet(PREF_EXCLUDED_FIELDS,
|
||||
new HashSet<String>())) {
|
||||
excludedFields.add(ReportField.valueOf(name));
|
||||
}
|
||||
|
||||
Toolbar tb = (Toolbar) findViewById(R.id.toolbar);
|
||||
getDelegate().setSupportActionBar(tb);
|
||||
|
||||
@@ -164,9 +149,6 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
}
|
||||
});
|
||||
|
||||
String userEmail = prefs.getString(ACRA.PREF_USER_EMAIL_ADDRESS, "");
|
||||
userEmailView.setText(userEmail);
|
||||
|
||||
if (state != null)
|
||||
reviewing = state.getBoolean(STATE_REVIEWING, isFeedback());
|
||||
|
||||
@@ -362,25 +344,15 @@ public class DevReportActivity extends BaseCrashReportDialog
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean success) {
|
||||
final SharedPreferences prefs =
|
||||
sharedPreferencesFactory.create();
|
||||
final SharedPreferences.Editor prefEditor =
|
||||
prefs.edit();
|
||||
Set<String> fields = new HashSet<>();
|
||||
for (ReportField field : excludedFields) {
|
||||
fields.add(field.name());
|
||||
}
|
||||
prefEditor.putStringSet(PREF_EXCLUDED_FIELDS, fields);
|
||||
prefEditor.apply();
|
||||
|
||||
if (success) {
|
||||
// Retrieve user's comment and email address, if any
|
||||
String comment = "";
|
||||
if (userCommentView != null)
|
||||
comment = userCommentView.getText().toString();
|
||||
String email = "";
|
||||
if (userEmailView != null)
|
||||
if (userEmailView != null) {
|
||||
email = userEmailView.getText().toString();
|
||||
}
|
||||
sendCrash(comment, email);
|
||||
}
|
||||
finish();
|
||||
|
||||
Reference in New Issue
Block a user