Skip to content

Commit 9f5dd6e

Browse files
author
martgil
committed
Merge remote-tracking branch 'origin/master' into snyk-upgrade-b2d13a45dde8d6a84bc14386121a8e42
2 parents 549233b + 6dd786d commit 9f5dd6e

File tree

16 files changed

+298
-594
lines changed

16 files changed

+298
-594
lines changed

.github/dependabot.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,11 @@ updates:
2626
# https://github.com/FlowCrypt/flowcrypt-browser/pull/3961#issuecomment-921335748
2727
- dependency-name: "iso-8859-2"
2828
versions: [ ">=1.0.1" ]
29-
- dependency-name: "@openpgp/web-stream-tools"
30-
versions: [">= 0.0.14"]
3129
- dependency-name: "ava"
3230
update-types: ["version-update:semver-major"]
3331
- dependency-name: "chai"
3432
update-types: ["version-update:semver-major"]
3533
- dependency-name: "chai-as-promised"
3634
update-types: ["version-update:semver-major"]
37-
- dependency-name: "openpgp"
38-
update-types: ["version-update:semver-major"]
3935
- dependency-name: "filesize"
40-
versions: [ ">= 10.1.3" ]
36+
versions: [ ">= 10.1.3" ]

.semaphore/semaphore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ blocks:
6161
run:
6262
when: branch = 'master' OR branch =~ 'live-test' OR branch =~ 'gmail-test'
6363
execution_time_limit:
64-
minutes: 45
64+
minutes: 60
6565
task:
6666
secrets:
6767
- name: flowcrypt-browser-ci-secrets

extension/changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<div class="lightboxed">
22

3+
version 8.5.9 on February 5, 2025: <a href="https://github.com/FlowCrypt/flowcrypt-browser/milestone/482?closed=1" target="_blank">Password-protected messages improvements, fixes for switching to secure mode</a>
4+
35
version 8.5.8 on December 20, 2024: <a href="https://github.com/FlowCrypt/flowcrypt-browser/milestone/481?closed=1" target="_blank">Encryption keys generation, encrypted messages parsing improvements</a>
46

57
version 8.5.7 on June 13, 2024: <a href="https://github.com/FlowCrypt/flowcrypt-browser/milestone/480?closed=1" target="_blank">Exception reports improvements</a>

extension/chrome/elements/compose-modules/formatters/encrypted-mail-msg-formatter.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,11 @@ export class EncryptedMsgMailFormatter extends BaseMailFormatter {
181181
{ msgUrl, externalId }: { msgUrl: string; externalId?: string },
182182
signingPrv?: Key
183183
) => {
184-
// encoded as: PGP/MIME-like structure but with attachments as external files due to email size limit (encrypted for pubkeys only)
184+
// encoded as: PGP/MIME-like structure
185185
const msgBody = this.richtext ? { 'text/plain': newMsg.plaintext, 'text/html': newMsg.plainhtml } : { 'text/plain': newMsg.plaintext };
186+
const attachments = await this.view.attachmentsModule.attachment.collectEncryptAttachments(pubs);
186187
// eslint-disable-next-line @typescript-eslint/naming-convention
187-
const pgpMimeNoAttachments = await Mime.encode(msgBody, { Subject: newMsg.subject }, []); // no attachments, attached to email separately
188+
const pgpMimeNoAttachments = await Mime.encode(msgBody, { Subject: newMsg.subject }, attachments);
188189
const { data: pubEncryptedNoAttachments } = await this.encryptDataArmor(Buf.fromUtfStr(pgpMimeNoAttachments), undefined, pubs, signingPrv); // encrypted only for pubs
189190
const emailIntroAndLinkBody = await this.formatPwdEncryptedMsgBodyLink(msgUrl);
190191
return await SendableMsg.createPwdMsg(

extension/css/cryptup.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,10 @@ div#contacts .select_contact .select_contact_email {
26752675
text-overflow: ellipsis;
26762676
}
26772677

2678+
div#contacts .select_contact:hover {
2679+
background: #eee;
2680+
}
2681+
26782682
div#contacts ul li img,
26792683
div#contacts div.allow-google-contact-search img {
26802684
padding-left: 6px;

extension/img/svgs/reply-all-icon.svg

Lines changed: 1 addition & 0 deletions
Loading

extension/js/common/xss-safe-factory.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,15 @@ export class XssSafeFactory {
269269
</div>`;
270270
};
271271

272-
public actionsMenuBtn = (action: 'reply' | 'forward') => {
273-
return `<div class="action_${action}_message_button action_menu_message_button" data-test="action-${action}-message-button">
274-
<img src="${this.srcImg(`svgs/${action}-icon.svg`)}" /><span>secure ${action}</span>
272+
public btnSecureMenuBtn = (replyOption: ReplyOption) => {
273+
const actionText = replyOption.replace('a_', '').replace('_', ' ');
274+
const action = {
275+
underscore: actionText.replace(' ', '_'),
276+
hyphen: actionText.replace(' ', '-'),
277+
};
278+
// * The action_${action.underscore}_message_button is used as an identifier in GmailElementReplacer.actionActivateSecureReplyHandler()
279+
return `<div class="action_${action.underscore}_message_button action_menu_message_button" data-test="action-${action.hyphen}-message-button">
280+
<img src="${this.srcImg(`svgs/${action.hyphen}-icon.svg`)}" /><span>secure ${actionText}</span>
275281
</div>`;
276282
};
277283

extension/js/content_scripts/webmail/generic/webmail-element-replacer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ export abstract class WebmailElementReplacer {
1414
public abstract reinsertReplyBox: (replyMsgId: string) => void;
1515
public abstract scrollToReplyBox: (replyMsgId: string) => void;
1616
public abstract scrollToCursorInReplyBox: (replyMsgId: string, cursorOffsetTop: number) => void;
17-
public abstract addSecureActionsToMessageMenu: () => void;
1817

1918
public runIntervalFunctionsPeriodically = () => {
2019
const intervalFunctions = this.getIntervalFunctions();

extension/js/content_scripts/webmail/gmail/gmail-element-replacer.ts

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class GmailElementReplacer extends WebmailElementReplacer {
7979
super();
8080
this.webmailCommon = new WebmailCommon(acctEmail, injector);
8181
this.pubLookup = new PubLookup(clientConfiguration);
82+
this.setupSecureActionsOnGmailMenu();
8283
}
8384

8485
public getIntervalFunctions = (): IntervalFunction[] => {
@@ -148,14 +149,14 @@ export class GmailElementReplacer extends WebmailElementReplacer {
148149
}
149150
};
150151

151-
public addSecureActionsToMessageMenu = () => {
152-
$(document).on('click', 'div.aHU.hx', event => {
153-
const $actionsBtn = $(event.currentTarget).find(this.sel.msgActionsBtn);
154-
if ($actionsBtn.length && !$('.action_menu_message_button').length) {
155-
this.addMenuButton('reply', '#r');
156-
this.addMenuButton('forward', '#r3');
152+
public setupSecureActionsOnGmailMenu = () => {
153+
const observer = new MutationObserver(() => {
154+
const gmailActionsMenu = document.querySelector(this.sel.msgActionsMenu);
155+
if (gmailActionsMenu && (gmailActionsMenu as HTMLElement).offsetParent !== undefined) {
156+
this.addSecureActionsToMessageMenu();
157157
}
158158
});
159+
observer.observe(document.body, { childList: true, subtree: true });
159160
};
160161

161162
private everything = () => {
@@ -291,13 +292,14 @@ export class GmailElementReplacer extends WebmailElementReplacer {
291292
return !!$('iframe.pgp_block').filter(':visible').length;
292293
};
293294

294-
private addMenuButton = (action: 'reply' | 'forward', selector: string) => {
295-
const gmailActionsMenuContainer = $(this.sel.msgActionsMenu).find(selector);
296-
const button = $(this.factory.actionsMenuBtn(action)).insertAfter(gmailActionsMenuContainer); // xss-safe-factory
297-
button.on(
298-
'click',
299-
Ui.event.handle((el, ev: JQuery.Event) => this.actionActivateSecureReplyHandler(el, ev))
300-
);
295+
private addMenuButton = (replyOption: ReplyOption, gmailContextMenuBtn: string) => {
296+
if ($(gmailContextMenuBtn).is(':visible')) {
297+
const button = $(this.factory.btnSecureMenuBtn(replyOption)).insertAfter(gmailContextMenuBtn); // xss-safe-factory
298+
button.on(
299+
'click',
300+
Ui.event.handle((el, ev: JQuery.Event) => this.actionActivateSecureReplyHandler(el, ev))
301+
);
302+
}
301303
};
302304

303305
private replaceConvoBtns = (force = false) => {
@@ -371,7 +373,14 @@ export class GmailElementReplacer extends WebmailElementReplacer {
371373
private actionActivateSecureReplyHandler = async (btn: HTMLElement, event: JQuery.Event) => {
372374
event.stopImmediatePropagation();
373375
const secureReplyInvokedFromMenu = btn.className.includes('action_menu_message_button');
374-
const replyOption: ReplyOption = btn.className.includes('reply') ? 'a_reply' : 'a_forward';
376+
let replyOption: ReplyOption;
377+
if (btn.className.includes('reply-all')) {
378+
replyOption = 'a_reply_all';
379+
} else if (btn.className.includes('forward')) {
380+
replyOption = 'a_forward';
381+
} else {
382+
replyOption = 'a_reply';
383+
}
375384
if ($('#switch_to_encrypted_reply').length) {
376385
$('#switch_to_encrypted_reply').trigger('click');
377386
return;
@@ -922,4 +931,13 @@ export class GmailElementReplacer extends WebmailElementReplacer {
922931
}
923932
}
924933
};
934+
935+
private addSecureActionsToMessageMenu = () => {
936+
if ($('.action_menu_message_button').length) {
937+
return;
938+
}
939+
this.addMenuButton('a_reply', '#r');
940+
this.addMenuButton('a_reply_all', '#r2');
941+
this.addMenuButton('a_forward', '#r3');
942+
};
925943
}

extension/js/content_scripts/webmail/gmail/gmail-webmail-startup.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export class GmailWebmailStartup {
4545
const messageRenderer = await MessageRenderer.newInstance(acctEmail, new Gmail(acctEmail), relayManager, factory);
4646
this.replacer = new GmailElementReplacer(factory, clientConfiguration, acctEmail, messageRenderer, injector, notifications, relayManager);
4747
await notifications.showInitial(acctEmail);
48-
this.replacer.addSecureActionsToMessageMenu();
4948
this.replacer.runIntervalFunctionsPeriodically();
5049
};
5150

0 commit comments

Comments
 (0)