[CrashReporting] Real send path with consent gating (DSN still placeholder)

require_user_consent + give/revoke around the Ask dialog, message event
with in-memory crash-log.txt bytes attachment, before_send scrubs
message/logentry/breadcrumbs/data of cockatrice:// secrets. Failure box
offers Save (shows path) / Discard (revokes + rejects) / Cancel (back
to dialog); reject() override so X/Escape cannot bypass revocation;
silent AlwaysSend path falls back to a local file. Empty DSN keeps the
previous mock behavior byte-identical.

Tests: 528/528 ctest green, format clean, code + UI gates PASS.
This commit is contained in:
Lukas Brübach 2026-10-14 09:25:05 +02:00 • committed by GitHub
parent 0d3750f2be
commit 038e56aab6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 331 additions and 34 deletions

View file

@ -15,21 +15,27 @@ class QLabel;
class QPlainTextEdit;
class QPushButton;
class CrashReporter;
/**
* @brief MOCK crash-report dialog (UI + settings only, no network).
* @brief Crash-report dialog: mock fallback or real Sentry send.
*
* The Send path writes a redacted JSON file to the temp dir instead of
* uploading anything. Real Sentry upload comes in a later phase.
* Mock mode (default): the Send path writes a redacted JSON file to the temp
* dir instead of uploading anything. Real mode (realSending, with a live
* CrashReporter): Send gives consent and captures a redacted message event
* with the log preview attached; failure offers a local save instead.
*/
class DlgCrashReport : public QDialog
{
Q_OBJECT
public:
explicit DlgCrashReport(QWidget *parent = nullptr);
explicit DlgCrashReport(QWidget *parent = nullptr, bool realSending = false, CrashReporter *_reporter = nullptr);
static QString buildRedactedPreview();
static QString writeMockReport(const QString &previewText);
void reject() override;
protected:
void changeEvent(QEvent *event) override;
@ -40,6 +46,8 @@ private:
QCheckBox *rememberBox;
QPushButton *sendButton;
QPushButton *dontSendButton;
bool realSending = false;
CrashReporter *reporter = nullptr;
void retranslateUi();