From c1b264e0bd52411a21f69a1845b3c69eeb8f563b Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Mon, 18 Sep 2023 18:32:10 +0200 Subject: [PATCH] fix: Don't send minidumps that are likely invalid --- .../integrations/sentry-minidump/minidump-loader.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/integrations/sentry-minidump/minidump-loader.ts b/src/main/integrations/sentry-minidump/minidump-loader.ts index 93022868..20318b95 100644 --- a/src/main/integrations/sentry-minidump/minidump-loader.ts +++ b/src/main/integrations/sentry-minidump/minidump-loader.ts @@ -50,10 +50,18 @@ function createMinidumpLoader(fetchMinidumpsImpl: MinidumpLoader): MinidumpLoade // remove it from the file system. knownPaths.push(dump.path); + const stats = await statAsync(dump.path); + // We do not want to upload minidumps that have been generated before a // certain threshold. Those old files can be deleted immediately. - const stats = await statAsync(dump.path); - if (stats.birthtimeMs < oldestMs) { + const tooOld = stats.birthtimeMs < oldestMs; + const tooSmall = stats.size < 1024; + + if (tooSmall) { + logger.log('Minidump too small to be valid', dump.path); + } + + if (tooOld || tooSmall) { await deleteMinidump(dump); knownPaths.splice(knownPaths.indexOf(dump.path), 1); return false;