fix: increase max crash key value length (#24782)
* fix: increase max crash key value length * chore: fix linting * chore: fix linux * Update spec-main/api-crash-reporter-spec.ts Co-authored-by: Jeremy Rose <jeremya@chromium.org> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com>
This commit is contained in:
parent
01023435c0
commit
d93bb34ac4
3 changed files with 34 additions and 5 deletions
|
@ -196,19 +196,30 @@ ifdescribe(!isLinuxOnArm && !process.mas && !process.env.DISABLE_CRASH_REPORTER_
|
|||
});
|
||||
|
||||
ifdescribe(!isLinuxOnArm)('extra parameter limits', () => {
|
||||
it('should truncate extra values longer than 127 characters', async () => {
|
||||
function stitchLongCrashParam (crash: any, paramKey: string) {
|
||||
if (crash[paramKey]) return crash[paramKey];
|
||||
let chunk = 1;
|
||||
let stitched = '';
|
||||
while (crash[`${paramKey}__${chunk}`]) {
|
||||
stitched += crash[`${paramKey}__${chunk}`];
|
||||
chunk++;
|
||||
}
|
||||
return stitched;
|
||||
}
|
||||
|
||||
it('should truncate extra values longer than 5 * 4096 characters', async () => {
|
||||
const { port, waitForCrash } = await startServer();
|
||||
const { remotely } = await startRemoteControlApp();
|
||||
remotely((port: number) => {
|
||||
require('electron').crashReporter.start({
|
||||
submitURL: `http://127.0.0.1:${port}`,
|
||||
ignoreSystemCrashHandler: true,
|
||||
extra: { longParam: 'a'.repeat(130) }
|
||||
extra: { longParam: 'a'.repeat(100000) }
|
||||
});
|
||||
setTimeout(() => process.crash());
|
||||
}, port);
|
||||
const crash = await waitForCrash();
|
||||
expect(crash).to.have.property('longParam', 'a'.repeat(127));
|
||||
expect(stitchLongCrashParam(crash, 'longParam')).to.have.lengthOf(160 * 127, 'crash should have truncated longParam');
|
||||
});
|
||||
|
||||
it('should omit extra keys with names longer than the maximum', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue