Skip to content

Commit 62da6a9

Browse files
authored
fix: Truncate minidump extra parameters when updating (#1361)
1 parent a355ed3 commit 62da6a9

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/main/integrations/electron-minidump.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export function minidumpUrlFromDsn(dsn: string): string | undefined {
9696
export const electronMinidumpIntegration = defineIntegration(() => {
9797
/** Counter used to ensure no race condition when updating extra params */
9898
let updateEpoch = 0;
99+
let lastParamCount = 0;
99100

100101
async function getNativeUploaderEvent(client: NodeClient, scope: ScopeData): Promise<Event> {
101102
const { sendDefaultPii = false } = client.getOptions();
@@ -128,9 +129,21 @@ export const electronMinidumpIntegration = defineIntegration(() => {
128129

129130
// Update the extra parameters in the main process
130131
const mainParams = getNativeUploaderExtraParams(event);
132+
const count = Object.keys(mainParams).length;
133+
134+
// Remove any extra parameters that extend beyond the current count
135+
if (lastParamCount > count) {
136+
for (let i = count + 1; i <= lastParamCount; i++) {
137+
crashReporter.removeExtraParameter(`sentry__${i}`);
138+
}
139+
}
140+
131141
for (const [key, value] of Object.entries(mainParams)) {
132142
crashReporter.addExtraParameter(key, value);
133143
}
144+
145+
// Track how many parameters we added so we can remove extras next time
146+
lastParamCount = count;
134147
})
135148
.catch((error) => debug.error(error));
136149
}

0 commit comments

Comments
 (0)