Skip to content

Commit bf67791

Browse files
committed
#1765 misc: optionally anonymize personal information in debug output
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
1 parent 768c78a commit bf67791

9 files changed

Lines changed: 273 additions & 36 deletions

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# QOwnNotes Changelog
22

3-
## 26.4.15
3+
## 26.4.16
44

5+
- Added an optional **Anonymize personal information** toggle to the
6+
**Debug information** settings page and the **issue assistant**, which can
7+
hide usernames in paths and anonymize note names, cloud account identifiers,
8+
saved searches, and sensitive environment values in generated debug
9+
information before it is shared (for [#1765](https://github.com/pbek/QOwnNotes/issues/1765))
510
- Added a rememberable confirmation dialog before opening items in the file
611
manager from note reveal and export actions, so accidental folder windows can
712
be suppressed per action after choosing **No** once with **Don't ask again!**

src/dialogs/issueassistantdialog.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ IssueAssistantDialog::IssueAssistantDialog(QWidget *parent)
1818
: MasterDialog(parent), ui(new Ui::IssueAssistantDialog) {
1919
ui->setupUi(this);
2020
afterSetupUI();
21+
const SettingsService settings;
22+
2123
ui->backButton->setEnabled(false);
2224
ui->nextButton->setEnabled(false);
25+
ui->debugInfoAnonymizeCheckBox->setChecked(
26+
settings.value(QStringLiteral("debugInfoAnonymize")).toBool());
2327

2428
ui->stackedWidget->setCurrentIndex(IssueAssistantPages::IssuePage);
2529
on_issueTypeComboBox_currentIndexChanged(ProblemIssueType);
@@ -112,8 +116,7 @@ void IssueAssistantDialog::refreshPage(int index) const {
112116
break;
113117
case DebugSettingsPage:
114118
if (ui->debugOutputPlainTextEdit->toPlainText().isEmpty()) {
115-
ui->debugOutputPlainTextEdit->setPlainText(
116-
Utils::Misc::generateDebugInformation(true));
119+
refreshDebugOutput();
117120
}
118121
break;
119122
case SubmitPage:
@@ -135,6 +138,11 @@ void IssueAssistantDialog::refreshLogOutput() const {
135138
ui->logOutputPlainTextEdit->setPlainText(mainWindow->getLogText());
136139
}
137140

141+
void IssueAssistantDialog::refreshDebugOutput() const {
142+
ui->debugOutputPlainTextEdit->setPlainText(
143+
Utils::Misc::generateDebugInformation(true, ui->debugInfoAnonymizeCheckBox->isChecked()));
144+
}
145+
138146
void IssueAssistantDialog::generateSubmitPageContent() const {
139147
QString title;
140148

@@ -272,3 +280,9 @@ void IssueAssistantDialog::on_newIssueButton_clicked() {
272280
ui->stackedWidget->setCurrentIndex(IssueAssistantPages::IssuePage);
273281
ui->issueTypeComboBox->setCurrentIndex(QuestionIssueType);
274282
}
283+
284+
void IssueAssistantDialog::on_debugInfoAnonymizeCheckBox_toggled(bool checked) {
285+
SettingsService settings;
286+
settings.setValue(QStringLiteral("debugInfoAnonymize"), checked);
287+
refreshDebugOutput();
288+
}

src/dialogs/issueassistantdialog.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ class IssueAssistantDialog : public MasterDialog {
4646

4747
void on_newIssueButton_clicked();
4848

49+
void on_debugInfoAnonymizeCheckBox_toggled(bool checked);
50+
4951
private:
5052
Ui::IssueAssistantDialog *ui;
5153

@@ -54,4 +56,6 @@ class IssueAssistantDialog : public MasterDialog {
5456
void generateSubmitPageContent() const;
5557

5658
void refreshPage(int index) const;
59+
60+
void refreshDebugOutput() const;
5761
};

src/dialogs/issueassistantdialog.ui

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,16 @@
419419
</property>
420420
</widget>
421421
</item>
422+
<item>
423+
<widget class="QCheckBox" name="debugInfoAnonymizeCheckBox">
424+
<property name="toolTip">
425+
<string notr="true">Hide usernames in paths and anonymize other personal identifiers in the generated debug information</string>
426+
</property>
427+
<property name="text">
428+
<string notr="true">Anonymize personal information</string>
429+
</property>
430+
</widget>
431+
</item>
422432
<item>
423433
<widget class="QOwnNotesMarkdownTextEdit" name="debugOutputPlainTextEdit"/>
424434
</item>
@@ -529,6 +539,7 @@
529539
<tabstop>refreshLogButton</tabstop>
530540
<tabstop>submitTitleLineEdit</tabstop>
531541
<tabstop>logOutputPlainTextEdit</tabstop>
542+
<tabstop>debugInfoAnonymizeCheckBox</tabstop>
532543
<tabstop>debugOutputPlainTextEdit</tabstop>
533544
<tabstop>bodyPlainTextEdit</tabstop>
534545
<tabstop>postButton</tabstop>

src/dialogs/settingsdialog.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,8 +1975,8 @@ void SettingsDialog::outputSettings() {
19751975
// store some data for Utils::Misc::generateDebugInformation
19761976
storeOwncloudDebugData();
19771977

1978-
QString output =
1979-
Utils::Misc::generateDebugInformation(ui->gitHubLineBreaksCheckBox->isChecked());
1978+
QString output = Utils::Misc::generateDebugInformation(
1979+
ui->gitHubLineBreaksCheckBox->isChecked(), ui->debugInfoAnonymizeCheckBox->isChecked());
19801980

19811981
ui->debugInfoTextEdit->setPlainText(output);
19821982
}
@@ -3565,6 +3565,12 @@ void SettingsDialog::on_gitHubLineBreaksCheckBox_toggled(bool checked) {
35653565
outputSettings();
35663566
}
35673567

3568+
void SettingsDialog::on_debugInfoAnonymizeCheckBox_toggled(bool checked) {
3569+
SettingsService settings;
3570+
settings.setValue(QStringLiteral("debugInfoAnonymize"), checked);
3571+
outputSettings();
3572+
}
3573+
35683574
/**
35693575
* Searches in the description and in the shortcut for a entered text
35703576
*
@@ -3760,6 +3766,10 @@ bool SettingsDialog::initializePage(int index) {
37603766
// init the debug info search frame
37613767
ui->debugInfoTextEdit->initSearchFrame(ui->debugInfoTextEditSearchFrame);
37623768

3769+
SettingsService settings;
3770+
ui->debugInfoAnonymizeCheckBox->setChecked(
3771+
settings.value(QStringLiteral("debugInfoAnonymize")).toBool());
3772+
37633773
// show the log file path
37643774
ui->logFileLabel->setText(QDir::toNativeSeparators(Utils::Misc::logFilePath()));
37653775
} break;

src/dialogs/settingsdialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,8 @@ class SettingsDialog : public MasterDialog {
179179

180180
void on_gitHubLineBreaksCheckBox_toggled(bool checked);
181181

182+
void on_debugInfoAnonymizeCheckBox_toggled(bool checked);
183+
182184
void on_shortcutSearchLineEdit_textChanged(const QString &arg1);
183185

184186
void on_settingsTreeWidget_currentItemChanged(QTreeWidgetItem *current,

src/dialogs/settingsdialog.ui

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4774,6 +4774,16 @@ Just test yourself if you get sync conflicts and set a higher value if so.</stri
47744774
</property>
47754775
</widget>
47764776
</item>
4777+
<item row="6" column="0" colspan="7">
4778+
<widget class="QCheckBox" name="debugInfoAnonymizeCheckBox">
4779+
<property name="toolTip">
4780+
<string>Hide usernames in paths and anonymize other personal identifiers in the generated debug information</string>
4781+
</property>
4782+
<property name="text">
4783+
<string>Anonymize personal information</string>
4784+
</property>
4785+
</widget>
4786+
</item>
47774787
<item row="4" column="0" colspan="7">
47784788
<widget class="QFrame" name="debugInfoTextEditSearchFrame">
47794789
<property name="frameShape">
@@ -4784,7 +4794,7 @@ Just test yourself if you get sync conflicts and set a higher value if so.</stri
47844794
</property>
47854795
</widget>
47864796
</item>
4787-
<item row="6" column="0">
4797+
<item row="7" column="0">
47884798
<widget class="QPushButton" name="issueAssistantPushButton">
47894799
<property name="toolTip">
47904800
<string>This is the best way to open an issue</string>
@@ -4798,7 +4808,7 @@ Just test yourself if you get sync conflicts and set a higher value if so.</stri
47984808
</property>
47994809
</widget>
48004810
</item>
4801-
<item row="6" column="1">
4811+
<item row="7" column="1">
48024812
<widget class="QPushButton" name="copyDebugInfoButton">
48034813
<property name="toolTip">
48044814
<string>Please use this in the issue tracker</string>
@@ -4812,7 +4822,7 @@ Just test yourself if you get sync conflicts and set a higher value if so.</stri
48124822
</property>
48134823
</widget>
48144824
</item>
4815-
<item row="6" column="2">
4825+
<item row="7" column="2">
48164826
<widget class="QPushButton" name="saveDebugInfoButton">
48174827
<property name="toolTip">
48184828
<string>Please don't use this in the issue tracker</string>
@@ -4826,7 +4836,7 @@ Just test yourself if you get sync conflicts and set a higher value if so.</stri
48264836
</property>
48274837
</widget>
48284838
</item>
4829-
<item row="6" column="3" colspan="4">
4839+
<item row="7" column="3" colspan="4">
48304840
<spacer name="horizontalSpacer_14">
48314841
<property name="orientation">
48324842
<enum>Qt::Orientation::Horizontal</enum>
@@ -8241,6 +8251,7 @@ Just test yourself if you get sync conflicts and set a higher value if so.</stri
82418251
<tabstop>exportSettingsButton</tabstop>
82428252
<tabstop>reinitializeDatabaseButton</tabstop>
82438253
<tabstop>gitHubLineBreaksCheckBox</tabstop>
8254+
<tabstop>debugInfoAnonymizeCheckBox</tabstop>
82448255
<tabstop>debugInfoTextEdit</tabstop>
82458256
<tabstop>noteTextEditFontLabel</tabstop>
82468257
<tabstop>noteTextEditButton</tabstop>

0 commit comments

Comments
 (0)