Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
martgil committed Aug 25, 2024
1 parent 25df0e6 commit 20a8b03
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,27 @@ export class ThunderbirdElementReplacer extends WebmailElementReplacer {
</div>`;
$('body').html(pgpBlockTemplate); // xss-sanitized
}
} else if (this.isClearTextSignedMsg(fullMsg)) {
} else if (this.isCleartextSignedMsg(fullMsg)) {
console.log('perform cleartext signed message verification!');
}
// else if signed message found
}
}
};

private isClearTextSignedMsg = (fullMsg: messenger.messages.MessagePart): boolean => {
private isCleartextSignedMsg = (fullMsg: messenger.messages.MessagePart): boolean => {
const isClearTextSignedMsg =
(fullMsg.headers &&
'openpgp' in fullMsg.headers &&
fullMsg.parts &&
fullMsg.parts[0]?.parts?.length === 1 &&
fullMsg.parts[0].parts[0].contentType === 'text/plain' &&
this.resemblesClearSignedMsg(fullMsg.parts[0].parts[0].body?.trim() || '')) ||
this.resemblesCleartextSignedMsg(fullMsg.parts[0].parts[0].body?.trim() || '')) ||
false;
return isClearTextSignedMsg;
};

private resemblesClearSignedMsg = (body: string) => {
private resemblesCleartextSignedMsg = (body: string) => {
return (
body.startsWith(PgpArmor.ARMOR_HEADER_DICT.signedMsg.begin) &&
body.includes(String(PgpArmor.ARMOR_HEADER_DICT.signedMsg.middle)) &&
Expand Down

0 comments on commit 20a8b03

Please sign in to comment.