Skip to content

Commit

Permalink
fix: Don't send minidumps that are likely invalid (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
timfish committed Sep 18, 2023
1 parent 9c550d4 commit 1c18341
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/main/integrations/sentry-minidump/minidump-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1c18341

Please sign in to comment.