Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export class PgpBlockViewDecryptModule {
this.view.signature.parsedSignature = parsed.signature;
await this.decryptAndRender(Buf.fromUtfStr(parsed.rawSignedContent), verificationPubs);
} else {
await this.view.errorModule.renderErr('Error: could not properly parse signed message', parsed.rawSignedContent || parsed.text || parsed.html || mimeMsg.toUtfStr());
await this.view.errorModule.renderErr('Error: could not properly parse signed message',
parsed.rawSignedContent || parsed.text || parsed.html || mimeMsg.toUtfStr(), true);
}
} else if (this.view.encryptedMsgUrlParam && !forcePullMsgFromApi) { // ascii armored message supplied
this.view.renderModule.renderText(this.view.signature ? 'Verifying..' : 'Decrypting...');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ export class PgpBlockViewErrorModule {
constructor(private view: PgpBlockView) {
}

public renderErr = async (errBoxContent: string, renderRawMsg: string | undefined) => {
public renderErr = async (errBoxContent: string, renderRawMsg: string | undefined, isParseError = false) => {
this.view.renderModule.setFrameColor('red');
if (isParseError) {
this.view.renderModule.renderSignatureStatus('parse error');
} else {
this.view.renderModule.renderEncryptionStatus('decrypt error');
}
const showRawMsgPrompt = renderRawMsg ? '<a href="#" class="action_show_raw_pgp_block">show original message</a>' : '';
await this.view.renderModule.renderContent(`<div class="error">${errBoxContent.replace(/\n/g, '<br>')}</div>${showRawMsgPrompt}`, true);
$('.action_show_raw_pgp_block').click(this.view.setHandler(async () => { // this may contain content missing MDC
Expand Down
18 changes: 18 additions & 0 deletions test/source/mock/google/exported-messages/corrupted-1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"acctEmail": "flowcrypt.compatibility@gmail.com",
"full": {
"id": "corrupted-1",
"threadId": "corrupted-1",
"historyId": "corrupted-1"
},
"raw": {
"id": "corrupted-1",
"threadId": "corrupted-1",
"labelIds": [
"INBOX"
],
"sizeEstimate": 2,
"raw": "RSo",
"historyId": "corrupted-1"
}
}
6 changes: 4 additions & 2 deletions test/source/mock/google/google-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ export class GoogleData {
msgCopy.raw = undefined;
}
if (format === 'metadata' || format === 'raw') {
msgCopy.payload!.body = undefined;
msgCopy.payload!.parts = undefined;
if (msgCopy.payload) {
msgCopy.payload.body = undefined;
msgCopy.payload.parts = undefined;
}
}
return msgCopy;
};
Expand Down
9 changes: 7 additions & 2 deletions test/source/tests/decrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -686,10 +686,10 @@ XZ8r4OC6sguP/yozWlkG+7dDxsgKQVBENeG6Lw==
}));

ava.default('decrypt - wrong message - checksum throws error', testWithBrowser('compatibility', async (t, browser) => {
const acctEmail = 'flowcrypt.compatibility@gmail.com';
const threadId = '15f7ffb9320bd79e';
const expectedContent = 'Ascii armor integrity check on message failed';
await InboxPageRecipe.checkDecryptMsg(t, browser, { acctEmail, threadId, expectedContent });
const params = `?frame_id=&threadId=${threadId}&msgId=${threadId}&senderEmail=&account_email=flowcrypt.compatibility%40gmail.com`;
await BrowserRecipe.pgpBlockVerifyDecryptedContent(t, browser, { params, content: [expectedContent], encryption: 'decrypt error', signature: '' });
}));

ava.default('decrypt - inbox - encrypted message inside signed', testWithBrowser('compatibility', async (t, browser) => {
Expand Down Expand Up @@ -735,6 +735,11 @@ XZ8r4OC6sguP/yozWlkG+7dDxsgKQVBENeG6Lw==
await pgpBlockPage.waitForContent('@container-err-text', 'API path traversal forbidden');
}));

ava.default(`decrypt - signed only - parse error in a badge`, testWithBrowser('compatibility', async (t, browser) => {
const params = "?frame_id=&msgId=corrupted-1&signature=___cu_true___&senderEmail=&account_email=flowcrypt.compatibility%40gmail.com";
await BrowserRecipe.pgpBlockVerifyDecryptedContent(t, browser, { params, content: [], encryption: '', signature: 'parse error' });
}));

ava.default(`decrypt - try path traversal forward slash workaround`, testWithBrowser('compatibility', async (t, browser) => {
const params = "?frame_id=frame_TWloVRhvZE&message=&message_id=..\\test&senderEmail=&is_outgoing=___cu_false___&account_email=flowcrypt.compatibility%40gmail.com";
const pgpHostPage = await browser.newPage(t, `chrome/dev/ci_pgp_host_page.htm${params}`);
Expand Down