Security review and fix issues

This commit is contained in:
2026-11-03 23:57:48 +02:00
parent 5f456e64d0
commit 78989f7b56
14 changed files with 95 additions and 18 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ pgpMailUi.wrapShowCompose(baseShowCompose => function (reply, forward = false) {
if (!selectPgpMailUi('#pgp-hint')) return;
if (status.missing.length) hint.textContent = `No public key for ${status.missing.join(', ')}`;
else {
hint.textContent = status.recipients.some(item => item.trust === 'unknown') ? 'Keys found; some are not verified yet' : 'Keys found for all recipients';
hint.textContent = status.recipients.some(item => item.trust !== 'verified') ? 'Keys found; some are not verified yet' : 'Keys found for all recipients';
if (!touched && !encrypt.checked) encrypt.checked = true;
}
} catch { hint.textContent = ''; }
+16 -1
View File
@@ -10113,7 +10113,7 @@ ${parts.join("")}`;
}
return results;
}
function createAndroidPgp({ EpMail: EpMail2, getAccount }) {
function createAndroidPgp({ EpMail: EpMail2, getAccount, confirm = globalThis.confirm }) {
let storePromise;
const passphrases = /* @__PURE__ */ new Map();
let cacheMinutes = 10;
@@ -10287,6 +10287,21 @@ Add the new key as an unverified key? Compare fingerprints with the owner before
if (pgp.encrypt && recipientKeys.missing.length) {
throw Object.assign(new Error(`No public key for ${recipientKeys.missing.join(", ")}.`), { code: "NO_RECIPIENT_KEY", missing: recipientKeys.missing });
}
const unverifiedKeys = recipientKeys.keys.filter((item) => item.trust !== "verified");
if (pgp.encrypt && unverifiedKeys.length) {
const details = unverifiedKeys.map(
(item) => `${item.address}
${item.fingerprint.match(/.{1,4}/g).join(" ")} (${item.trust})`
).join("\n\n");
const warning = `These recipient keys have not been verified by fingerprint:
${details}
If a key is incorrect, its owner may be able to read this message. Compare each fingerprint with its owner through another channel before sending. Send encrypted mail to these unverified keys anyway?`;
if (typeof confirm !== "function" || !confirm(warning)) {
throw Object.assign(new Error("Sending to unverified recipient keys was cancelled."), { code: "UNVERIFIED_RECIPIENT_KEY" });
}
}
let inner = mimeInner(`${String(message.text || "").slice(0, 5e5)}${account.signature ? `
${String(account.signature).slice(0, 5e3)}` : ""}`, message.attachments || []);