domma-cms 1.29.1 → 1.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/docs/DommaFeatures.md +1 -1
- package/package.json +1 -1
- package/plugins/_lib/admin/mail/body-menu.js +1 -1
- package/plugins/_lib/admin/mail/cms-host.js +1 -1
- package/plugins/_lib/admin/mail/compose-window.js +1 -1
- package/plugins/_lib/admin/mail/contacts.js +1 -1
- package/plugins/_lib/admin/mail/diagnostics-section.js +1 -1
- package/plugins/_lib/admin/mail/drag-drop.js +1 -1
- package/plugins/_lib/admin/mail/folder-tree.js +22 -1
- package/plugins/_lib/admin/mail/font-controls.js +1 -1
- package/plugins/_lib/admin/mail/fonts.js +1 -1
- package/plugins/_lib/admin/mail/host-context.js +1 -1
- package/plugins/_lib/admin/mail/identity.js +1 -1
- package/plugins/_lib/admin/mail/image-senders-section.js +68 -1
- package/plugins/_lib/admin/mail/keyboard.js +1 -1
- package/plugins/_lib/admin/mail/mail.css +1 -1
- package/plugins/_lib/admin/mail/mail.html +1 -1
- package/plugins/_lib/admin/mail/message-actions.js +1 -1
- package/plugins/_lib/admin/mail/oauth-panel.js +1 -1
- package/plugins/_lib/admin/mail/panes.js +1 -1
- package/plugins/_lib/admin/mail/reader-kit.js +1 -1
- package/plugins/_lib/admin/mail/reader-runtime.js +91 -5
- package/plugins/_lib/admin/mail/reader-view.js +1 -1
- package/plugins/_lib/admin/mail/resizable.js +1 -1
- package/plugins/_lib/admin/mail/restore-spam.js +1 -1
- package/plugins/_lib/admin/mail/rules.js +7 -3
- package/plugins/_lib/admin/mail/scheduling.js +1 -1
- package/plugins/_lib/admin/mail/section-kit.js +1 -1
- package/plugins/_lib/admin/mail/security-note.js +1 -1
- package/plugins/_lib/admin/mail/settings-section.js +1 -1
- package/plugins/_lib/admin/mail/templates.js +1 -1
- package/plugins/_lib/admin/mail/threads.js +1 -1
- package/plugins/_lib/admin/mail/vacation.js +1 -1
- package/plugins/_lib/admin/mail/when-closed.js +1 -1
- package/plugins/_lib/admin/ui/dates.js +1 -1
- package/plugins/_lib/admin/ui/resizable.js +1 -1
- package/plugins/_lib/domma-mail.lock.json +80 -79
- package/plugins/_lib/mail/accountFileStore.js +1 -1
- package/plugins/_lib/mail/accountRepository.js +36 -2
- package/plugins/_lib/mail/accountRoutes.js +1 -1
- package/plugins/_lib/mail/accounts.js +1 -1
- package/plugins/_lib/mail/bodyTokenProvider.js +1 -1
- package/plugins/_lib/mail/bodyTokens.js +1 -1
- package/plugins/_lib/mail/compose.js +1 -1
- package/plugins/_lib/mail/defaults.js +1 -1
- package/plugins/_lib/mail/envelope.js +1 -1
- package/plugins/_lib/mail/folderActions.js +1 -1
- package/plugins/_lib/mail/folderRuntime.js +1 -1
- package/plugins/_lib/mail/folders.js +1 -1
- package/plugins/_lib/mail/imapPoolRuntime.js +1 -1
- package/plugins/_lib/mail/mbox.js +1 -1
- package/plugins/_lib/mail/message-action.js +1 -1
- package/plugins/_lib/mail/messageSecurity.js +1 -1
- package/plugins/_lib/mail/messageSecurityProvider.js +1 -1
- package/plugins/_lib/mail/networkAddresses.js +1 -1
- package/plugins/_lib/mail/networkPolicy.js +1 -1
- package/plugins/_lib/mail/oauthAccounts.js +1 -1
- package/plugins/_lib/mail/oauthRouteRuntime.js +1 -1
- package/plugins/_lib/mail/oauthRuntime.js +1 -1
- package/plugins/_lib/mail/pollSchedule.js +1 -1
- package/plugins/_lib/mail/poller.js +1 -1
- package/plugins/_lib/mail/pollerRuntime.js +1 -1
- package/plugins/_lib/mail/priority.js +1 -1
- package/plugins/_lib/mail/publicMailbox.js +1 -1
- package/plugins/_lib/mail/readRuntime.js +57 -3
- package/plugins/_lib/mail/render.js +1 -1
- package/plugins/_lib/mail/ruleRunner.js +1 -1
- package/plugins/_lib/mail/schedulerRuntime.js +1 -1
- package/plugins/_lib/mail/secretProvider.js +1 -1
- package/plugins/_lib/mail/secretbox.js +1 -1
- package/plugins/_lib/mail/senderAuth.js +113 -0
- package/plugins/_lib/mail/sieve.js +7 -2
- package/plugins/_lib/mail/smtpService.js +1 -1
- package/plugins/_lib/mail/snoozeRuntime.js +1 -1
- package/plugins/_lib/mail/store.js +1 -1
- package/plugins/_lib/mail/subscriptions.js +1 -1
- package/plugins/_lib/mail/syncPlan.js +1 -1
- package/plugins/_lib/mail/syncRuntime.js +1 -1
- package/plugins/_lib/mail/syncSelection.js +1 -1
- package/plugins/_lib/mail/unreadBadge.js +1 -1
- package/plugins/_lib/mail/unsubscribe.js +1 -1
- package/plugins/_lib/mail/vacationRuntime.js +1 -1
- package/plugins/_lib/mail/write.js +4 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/schedulerRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The worker behind "send later", "undo send" and "snooze".
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/secretProvider.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {createCipheriv, createDecipheriv, createHash, randomBytes, scryptSync} from 'node:crypto';
|
|
4
4
|
import fs from 'node:fs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/secretbox.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** CMS compatibility entry point. Standalone hosts create their own secret box. */
|
|
4
4
|
import path from 'node:path';
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/senderAuth.js.
|
|
2
|
+
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
|
+
/**
|
|
4
|
+
* Did this message really come from the address in its From line?
|
|
5
|
+
*
|
|
6
|
+
* Used before loading a contact's remote images automatically: anyone can
|
|
7
|
+
* write a contact's address into From, so being in the contacts list is not
|
|
8
|
+
* enough on its own. The answer comes from the RECEIVING mail server's own
|
|
9
|
+
* check, recorded in an Authentication-Results header (RFC 8601).
|
|
10
|
+
*
|
|
11
|
+
* Only a header the receiving server wrote counts. A sender can put any
|
|
12
|
+
* Authentication-Results it likes into its own message, so:
|
|
13
|
+
*
|
|
14
|
+
* - the server that took delivery is the `by` host of the topmost Received
|
|
15
|
+
* header (each hop adds its Received line at the top);
|
|
16
|
+
* - a result counts only when its authserv-id is that host, or another host
|
|
17
|
+
* in the same domain (a local delivery step on the same system), AND it
|
|
18
|
+
* sits ABOVE the first Received line that host wrote. Anything a sender
|
|
19
|
+
* forged arrives below that line, whatever names it uses.
|
|
20
|
+
*
|
|
21
|
+
* A pass is any of: dmarc=pass; dkim=pass whose signing domain (header.d)
|
|
22
|
+
* aligns with the From domain; spf=pass whose smtp.mailfrom domain aligns.
|
|
23
|
+
* "Aligns" is relaxed alignment: the same organisational domain (example.co.uk).
|
|
24
|
+
*
|
|
25
|
+
* No such header, or nothing aligned that passed, is NOT verified - the safe
|
|
26
|
+
* answer, so images stay blocked as before.
|
|
27
|
+
*
|
|
28
|
+
* Pure: header lines in, an answer out.
|
|
29
|
+
*
|
|
30
|
+
* @module _lib/mail/senderAuth
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/** Second-level labels that are public suffixes under a country code (co.uk, com.au...). */
|
|
34
|
+
const SECOND_LEVEL = /^(co|com|org|net|ac|gov|ltd|plc|me|sch|nhs|edu|nom|or|ne|go)\.[a-z]{2}$/;
|
|
35
|
+
|
|
36
|
+
/** The registrable part of a host name, roughly: example.co.uk, example.com. */
|
|
37
|
+
export function baseDomain(host) {
|
|
38
|
+
const labels = String(host ?? '').toLowerCase().replace(/\.$/, '').split('.').filter(Boolean);
|
|
39
|
+
if (labels.length < 2) return labels.join('.');
|
|
40
|
+
const lastTwo = labels.slice(-2).join('.');
|
|
41
|
+
return SECOND_LEVEL.test(lastTwo) && labels.length >= 3 ? labels.slice(-3).join('.') : lastTwo;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Relaxed alignment (DMARC): the same organisational domain. Never a bare public suffix. */
|
|
45
|
+
export function aligned(a, b) {
|
|
46
|
+
const x = baseDomain(a), y = baseDomain(b);
|
|
47
|
+
return Boolean(x) && x.includes('.') && !SECOND_LEVEL.test(x) && x === y;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const unfold = line => String(line ?? '').replace(/\r?\n[ \t]+/g, ' ');
|
|
51
|
+
const valueOf = line => unfold(line).replace(/^[^:]*:\s*/, '');
|
|
52
|
+
/** Comments in parentheses removed (RFC 5322 CFWS, one level deep is all servers write). */
|
|
53
|
+
const uncomment = text => text.replace(/\([^()]*\)/g, ' ');
|
|
54
|
+
|
|
55
|
+
/** The `by` host of a Received header, or null. */
|
|
56
|
+
export function receivedBy(value) {
|
|
57
|
+
const match = /\bby\s+([A-Za-z0-9.-]+\.[A-Za-z]{2,})/i.exec(uncomment(String(value ?? '')));
|
|
58
|
+
return match ? match[1].toLowerCase() : null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* One Authentication-Results value -> {authservId, results: [{method, result, props}]}.
|
|
63
|
+
*
|
|
64
|
+
* @param {string} value
|
|
65
|
+
* @returns {{authservId: string, results: object[]}}
|
|
66
|
+
*/
|
|
67
|
+
export function parseAuthResults(value) {
|
|
68
|
+
const parts = uncomment(String(value ?? '')).split(';').map(s => s.trim()).filter(Boolean);
|
|
69
|
+
const authservId = (parts.shift() ?? '').split(/\s+/)[0].toLowerCase();
|
|
70
|
+
const results = [];
|
|
71
|
+
for (const part of parts) {
|
|
72
|
+
const match = /^([a-z0-9-]+)\s*=\s*([a-z0-9-]+)(.*)$/i.exec(part);
|
|
73
|
+
if (!match) continue;
|
|
74
|
+
const props = {};
|
|
75
|
+
for (const prop of match[3].matchAll(/([a-z0-9-]+\.[a-z0-9-]+)\s*=\s*("[^"]*"|[^\s;]+)/gi)) {
|
|
76
|
+
props[prop[1].toLowerCase()] = prop[2].replace(/^"|"$/g, '');
|
|
77
|
+
}
|
|
78
|
+
results.push({method: match[1].toLowerCase(), result: match[2].toLowerCase(), props});
|
|
79
|
+
}
|
|
80
|
+
return {authservId, results};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** The domain of an address or @domain / user@domain identity. */
|
|
84
|
+
const domainOf = value => String(value ?? '').toLowerCase().split('@').pop().replace(/[>\s]/g, '');
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @param {{key: string, line: string}[]} headerLines - in message order (mailparser's `headerLines`)
|
|
88
|
+
* @param {string} fromAddress
|
|
89
|
+
* @returns {{ok: boolean, via?: string, reason?: string}}
|
|
90
|
+
*/
|
|
91
|
+
export function senderAuthenticated(headerLines, fromAddress) {
|
|
92
|
+
const fromDomain = domainOf(fromAddress);
|
|
93
|
+
if (!fromDomain.includes('.')) return {ok: false, reason: 'The sender has no domain to check.'};
|
|
94
|
+
const lines = (headerLines ?? []).map(h => ({key: String(h?.key ?? '').toLowerCase(), value: valueOf(h?.line)}));
|
|
95
|
+
const received = lines.map((h, i) => ({...h, i})).filter(h => h.key === 'received');
|
|
96
|
+
const receiver = received.length ? receivedBy(received[0].value) : null;
|
|
97
|
+
if (!receiver) return {ok: false, reason: 'The message does not say which server received it.'};
|
|
98
|
+
for (const [i, h] of lines.entries()) {
|
|
99
|
+
if (h.key !== 'authentication-results') continue;
|
|
100
|
+
const {authservId, results} = parseAuthResults(h.value);
|
|
101
|
+
if (!authservId || (authservId !== receiver && baseDomain(authservId) !== baseDomain(receiver))) continue;
|
|
102
|
+
// Must sit above the first Received line its own server wrote.
|
|
103
|
+
const own = received.find(r => receivedBy(r.value) === authservId);
|
|
104
|
+
if (!own || own.i < i) continue;
|
|
105
|
+
for (const r of results) {
|
|
106
|
+
if (r.result !== 'pass') continue;
|
|
107
|
+
if (r.method === 'dmarc') return {ok: true, via: 'dmarc'};
|
|
108
|
+
if (r.method === 'dkim' && aligned(domainOf(r.props['header.d'] ?? r.props['header.i']), fromDomain)) return {ok: true, via: 'dkim'};
|
|
109
|
+
if (r.method === 'spf' && aligned(domainOf(r.props['smtp.mailfrom']), fromDomain)) return {ok: true, via: 'spf'};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return {ok: false, reason: 'Your mail server did not confirm this message came from the sender\'s domain.'};
|
|
113
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/sieve.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/** ManageSieve (RFC 5804). One bounded, TLS-verified session per operation. */
|
|
4
4
|
import net from 'node:net';
|
|
@@ -199,7 +199,12 @@ export async function connectSieve({target, port = 4190, security = 'starttls',
|
|
|
199
199
|
const secure = (adapters.tlsConnect ?? tls.connect)({socket, ...tlsOptions});
|
|
200
200
|
session.attach(secure);
|
|
201
201
|
await connected(secure, 'secureConnect');
|
|
202
|
-
|
|
202
|
+
// RFC 5804 2.2: once TLS is up the server re-issues its capabilities
|
|
203
|
+
// unasked, ending in OK. Sending CAPABILITY here as well put every
|
|
204
|
+
// later reply one behind (sign-in read CAPABILITY's OK, LISTSCRIPTS
|
|
205
|
+
// read the capability lines), so the scripts never showed.
|
|
206
|
+
session.received = 0;
|
|
207
|
+
caps = capabilities(await session.response());
|
|
203
208
|
}
|
|
204
209
|
if (!caps.SASL?.split(/\s+/).includes('PLAIN')) throw new SieveError('This Sieve server does not offer password authentication over TLS.', 409);
|
|
205
210
|
const token = Buffer.from(`\0${auth.user}\0${auth.pass}`).toString('base64');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/smtpService.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Sending, and keeping a copy where the rest of your clients will find it.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/snoozeRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {safeWritePool, moveMessage} from './write.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/subscriptions.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
export function resolveSubscriptions(boxes) {
|
|
4
4
|
const list = boxes ?? [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/syncRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {missingUids, planFolderSync} from './syncPlan.js';
|
|
4
4
|
import {resolveSyncFolders} from './syncSelection.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/syncSelection.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Which folders a mailbox keeps mirrored.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/unreadBadge.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* The free reader's sidebar badge - unread mail in each mailbox's INBOX.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/vacationRuntime.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
import {randomUUID} from 'node:crypto';
|
|
4
4
|
import {autoReplyHeaders, isActive, normaliseVacation, replySubject, shouldAutoReply, replyHistory} from '../admin/mail/vacation.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Source: @domma-mail/core 0.
|
|
1
|
+
// Source: @domma-mail/core 0.20.0, packages/core/src/mail/write.js.
|
|
2
2
|
// Update with domma-mail/scripts/sync-cms.mjs; edit the shared source.
|
|
3
3
|
/**
|
|
4
4
|
* Changing mail, rather than reading it.
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @module _lib/mail/write
|
|
16
16
|
*/
|
|
17
17
|
import {ENVELOPE_QUERY, toRecord} from './envelope.js';
|
|
18
|
+
import {isSpamFolder} from '../admin/mail/folder-tree.js';
|
|
18
19
|
|
|
19
20
|
/** Refuse IMAP fallbacks that could expunge mail outside the selected UID set. */
|
|
20
21
|
export function safeWritePool(pool) {
|
|
@@ -355,7 +356,8 @@ export const NOT_JUNK_KEYWORD = '$NotJunk';
|
|
|
355
356
|
* @returns {{destination: string|null, add: string[], remove: string[]}}
|
|
356
357
|
*/
|
|
357
358
|
export function planSpamMove({spam, folder, junkFolder, inboxFolder = 'INBOX'}) {
|
|
358
|
-
|
|
359
|
+
// The \Junk folder, or a plain folder a server filter files spam into.
|
|
360
|
+
const inJunk = isSpamFolder(folder, junkFolder);
|
|
359
361
|
|
|
360
362
|
if (spam) {
|
|
361
363
|
return {
|