imap-wizard 0.3.1 → 0.3.2
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/NOTICE +30 -0
- package/README.md +33 -24
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +22 -1
- package/dist/config/schema.js.map +1 -1
- package/dist/connections/credential-redaction.d.ts +38 -0
- package/dist/connections/credential-redaction.d.ts.map +1 -0
- package/dist/connections/credential-redaction.js +202 -0
- package/dist/connections/credential-redaction.js.map +1 -0
- package/dist/connections/manager.d.ts.map +1 -1
- package/dist/connections/manager.js +23 -8
- package/dist/connections/manager.js.map +1 -1
- package/dist/services/imap.service.d.ts +7 -0
- package/dist/services/imap.service.d.ts.map +1 -1
- package/dist/services/imap.service.js +12 -2
- package/dist/services/imap.service.js.map +1 -1
- package/dist/services/oauth.service.d.ts.map +1 -1
- package/dist/services/oauth.service.js +9 -2
- package/dist/services/oauth.service.js.map +1 -1
- package/dist/services/smtp.service.d.ts +4 -0
- package/dist/services/smtp.service.d.ts.map +1 -1
- package/dist/services/smtp.service.js +11 -3
- package/dist/services/smtp.service.js.map +1 -1
- package/dist/services/watcher.service.d.ts.map +1 -1
- package/dist/services/watcher.service.js +2 -1
- package/dist/services/watcher.service.js.map +1 -1
- package/dist/utils/loopback.d.ts +3 -0
- package/dist/utils/loopback.d.ts.map +1 -0
- package/dist/utils/loopback.js +14 -0
- package/dist/utils/loopback.js.map +1 -0
- package/package.json +3 -2
package/NOTICE
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
IMAP Wizard
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
This project is a fork of email-mcp (https://github.com/codefuturist/email-mcp),
|
|
5
|
+
licensed under LGPL-3.0-or-later. The original code remains copyright its
|
|
6
|
+
original authors (see the upstream repository and its history). Changes made in
|
|
7
|
+
this fork are licensed under the same terms.
|
|
8
|
+
|
|
9
|
+
This project is not an official project of codefuturist/email-mcp or of Mailoo.
|
|
10
|
+
|
|
11
|
+
Code adapted from other projects
|
|
12
|
+
--------------------------------
|
|
13
|
+
|
|
14
|
+
This project includes code adapted from Mailoo
|
|
15
|
+
(https://github.com/Bitfloo/mailoo, commit f537225),
|
|
16
|
+
Copyright (c) 2026 Bitfloo, licensed under LGPL-3.0-or-later.
|
|
17
|
+
|
|
18
|
+
The adapted files are:
|
|
19
|
+
|
|
20
|
+
src/utils/loopback.ts loopback host check
|
|
21
|
+
src/utils/loopback.test.ts tests for the above
|
|
22
|
+
src/config/schema.ts plain-text login guard (the
|
|
23
|
+
superRefine on AccountConfigSchema)
|
|
24
|
+
src/connections/credential-redaction.ts credential redaction in error text
|
|
25
|
+
src/connections/credential-redaction.test.ts
|
|
26
|
+
src/mcp-catalog.test.ts tool catalog baseline test (approach;
|
|
27
|
+
the baseline data is original)
|
|
28
|
+
|
|
29
|
+
"Mailoo" and "Bitfloo" are names of their respective owners. They are used here
|
|
30
|
+
only to attribute the code above and are not used as branding for this project.
|
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ over plain IMAP and SMTP. No cloud service in the middle.
|
|
|
29
29
|
> [codefuturist/email-mcp](https://github.com/codefuturist/email-mcp) by
|
|
30
30
|
> [@codefuturist](https://github.com/codefuturist), under the same
|
|
31
31
|
> [LGPL-3.0-or-later](LICENSE) license. It keeps upstream's design and history,
|
|
32
|
-
> fixes bugs
|
|
32
|
+
> fixes bugs upstream still has, and adds safety
|
|
33
33
|
> features. The package and command are called `imap-wizard`. See
|
|
34
34
|
> [Relationship to upstream](#relationship-to-upstream).
|
|
35
35
|
|
|
@@ -99,11 +99,11 @@ Setup for other clients is under [More clients](#more-clients).
|
|
|
99
99
|
|
|
100
100
|
## Why this one
|
|
101
101
|
|
|
102
|
-
- **Bugs fixed that
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
[Full list](#relationship-to-upstream).
|
|
102
|
+
- **Bugs fixed that upstream still has.** As of upstream v0.6.0: duplicate
|
|
103
|
+
sends on retry, `read_only` not stopping background mail, stdio processes
|
|
104
|
+
that never exit, "Re: RE:" subjects stacking, and Sent copies rejected by
|
|
105
|
+
strict servers. Several others we fixed first have since been fixed upstream
|
|
106
|
+
too. [Full list with upstream status](#relationship-to-upstream).
|
|
107
107
|
- **Reading never changes your mailbox.** `get_email` fetches with IMAP
|
|
108
108
|
`BODY.PEEK`, so mail you read stays unread unless you ask (`markRead: true`).
|
|
109
109
|
- **A real read-only mode.** With `read_only = true`, write tools are not
|
|
@@ -129,6 +129,7 @@ Setup for other clients is under [More clients](#more-clients).
|
|
|
129
129
|
| Duplicate-send guard | on | A retried send is recognized and refused unless you pass `allow_duplicate` |
|
|
130
130
|
| HTTP transport token | required | `http` mode generates a bearer token, even on loopback |
|
|
131
131
|
| Verification-code tool | off | `get_verification_code` is only registered when you enable it; it never reads your clipboard |
|
|
132
|
+
| Encrypted logins | enforced | A config with `tls = false` and `starttls = false` to a non-loopback host is refused at load. Credentials in server error text are replaced with `[redacted]` |
|
|
132
133
|
| Body cache (`read_through`) | **off** | Message bodies are only stored on disk if you turn it on. [Details](#local-body-cache-opt-in-unreleased) |
|
|
133
134
|
|
|
134
135
|
What is stored on disk by default: your `config.toml` (written owner-only), the
|
|
@@ -251,7 +252,7 @@ variables, for example `MCP_EMAIL_READ_ONLY=true`, `MCP_EMAIL_RATE_LIMIT`,
|
|
|
251
252
|
|
|
252
253
|
</details>
|
|
253
254
|
|
|
254
|
-
### Local body cache (opt-in
|
|
255
|
+
### Local body cache (opt-in)
|
|
255
256
|
|
|
256
257
|
> Merged on the development branch, **off by default**, and not yet in a tagged
|
|
257
258
|
> release.
|
|
@@ -400,26 +401,32 @@ The review of upstream's v0.4 and v0.5 features is in
|
|
|
400
401
|
in the [CHANGELOG](CHANGELOG.md).
|
|
401
402
|
|
|
402
403
|
<details>
|
|
403
|
-
<summary><strong>Upstream issues fixed here</strong
|
|
404
|
+
<summary><strong>Upstream issues fixed here</strong>, with upstream's own status as of v0.6.0 (checked 2026-11-17)</summary>
|
|
404
405
|
|
|
405
406
|
<br>
|
|
406
407
|
|
|
407
|
-
| Issue | Problem | Fix in this fork |
|
|
408
|
-
|
|
409
|
-
| [#12](https://github.com/codefuturist/email-mcp/issues/12) | Attachments only returned as base64 | `savePath` writes to disk and returns path, size and SHA-256 |
|
|
410
|
-
| [#20](https://github.com/codefuturist/email-mcp/issues/20) [#54](https://github.com/codefuturist/email-mcp/issues/54) [#92](https://github.com/codefuturist/email-mcp/issues/92) | Sent mail never saved to Sent | IMAP APPEND into Sent after every send |
|
|
411
|
-
| [#45](https://github.com/codefuturist/email-mcp/issues/45) | `forward_email` ignores `html` | Honoured |
|
|
412
|
-
| [#52](https://github.com/codefuturist/email-mcp/issues/52) | No attachments on send | Attachments on send, forward and draft |
|
|
413
|
-
| [#55](https://github.com/codefuturist/email-mcp/issues/55) | Memory leak in long-running process | Connections rotate every 30 minutes; caches evicted |
|
|
414
|
-
| [#57](https://github.com/codefuturist/email-mcp/issues/57) | Socket timeout crashes the process | Error and close handlers on every IMAP client |
|
|
415
|
-
| [#58](https://github.com/codefuturist/email-mcp/issues/58) | Every call fails on llama.cpp models | Grammar-safe (GBNF) schemas |
|
|
416
|
-
| [#59](https://github.com/codefuturist/email-mcp/issues/59) | Results ordered by UID | Ordered by date across the whole match set |
|
|
417
|
-
| [#60](https://github.com/codefuturist/email-mcp/issues/60) | stdio server never exits | Exits when the client closes stdin; optional idle exit |
|
|
418
|
-
| [#62](https://github.com/codefuturist/email-mcp/issues/62) | Retries send duplicates | Retried sends recognized and refused |
|
|
419
|
-
| [#66](https://github.com/codefuturist/email-mcp/issues/66) [#95](https://github.com/codefuturist/email-mcp/issues/95) | Raw MIME instead of the body | Decoded bodies; richer multipart part preferred |
|
|
420
|
-
| [#71](https://github.com/codefuturist/email-mcp/issues/71) [#91](https://github.com/codefuturist/email-mcp/issues/91) | Silent zero results on broken servers |
|
|
421
|
-
| [#79](https://github.com/codefuturist/email-mcp/issues/79) | `read_only` does not gate background work | Calendar writes and background services gated |
|
|
422
|
-
| [#96](https://github.com/codefuturist/email-mcp/issues/96) | Non-ASCII draft subjects not encoded | Drafts built with MailComposer (RFC 2047) |
|
|
408
|
+
| Issue | Problem | Fix in this fork | Upstream v0.6.0 |
|
|
409
|
+
|---|---|---|---|
|
|
410
|
+
| [#12](https://github.com/codefuturist/email-mcp/issues/12) | Attachments only returned as base64 | `savePath` writes to disk and returns path, size and SHA-256 | Partly: a server-wide download folder on main, no per-call path |
|
|
411
|
+
| [#20](https://github.com/codefuturist/email-mcp/issues/20) [#54](https://github.com/codefuturist/email-mcp/issues/54) [#92](https://github.com/codefuturist/email-mcp/issues/92) | Sent mail never saved to Sent | IMAP APPEND into Sent after every send, on by default | Partly: opt-in, off by default |
|
|
412
|
+
| [#45](https://github.com/codefuturist/email-mcp/issues/45) | `forward_email` ignores `html` | Honoured | Fixed |
|
|
413
|
+
| [#52](https://github.com/codefuturist/email-mcp/issues/52) | No attachments on send | Attachments on send, forward and draft | Partly: `send_draft` still drops them |
|
|
414
|
+
| [#55](https://github.com/codefuturist/email-mcp/issues/55) | Memory leak in long-running process | Connections rotate every 30 minutes; caches evicted | Open (no rotation found; unverified) |
|
|
415
|
+
| [#57](https://github.com/codefuturist/email-mcp/issues/57) | Socket timeout crashes the process | Error and close handlers on every IMAP client | Fixed on main after v0.6.0 |
|
|
416
|
+
| [#58](https://github.com/codefuturist/email-mcp/issues/58) | Every call fails on llama.cpp models | Grammar-safe (GBNF) schemas | Fixed (via zod update) |
|
|
417
|
+
| [#59](https://github.com/codefuturist/email-mcp/issues/59) | Results ordered by UID | Ordered by date across the whole match set | Partly: only the current page is re-sorted |
|
|
418
|
+
| [#60](https://github.com/codefuturist/email-mcp/issues/60) | stdio server never exits | Exits when the client closes stdin; optional idle exit | Open |
|
|
419
|
+
| [#62](https://github.com/codefuturist/email-mcp/issues/62) | Retries send duplicates | Retried sends recognized and refused | Open |
|
|
420
|
+
| [#66](https://github.com/codefuturist/email-mcp/issues/66) [#95](https://github.com/codefuturist/email-mcp/issues/95) | Raw MIME instead of the body | Decoded bodies; richer multipart part preferred | Fixed |
|
|
421
|
+
| [#71](https://github.com/codefuturist/email-mcp/issues/71) [#91](https://github.com/codefuturist/email-mcp/issues/91) | Silent zero results on broken servers | A malformed (non-array) search reply fails loudly | Partly: the imapflow update avoids the Strato case |
|
|
422
|
+
| [#79](https://github.com/codefuturist/email-mcp/issues/79) | `read_only` does not gate background work | Calendar writes and background services gated | Open |
|
|
423
|
+
| [#96](https://github.com/codefuturist/email-mcp/issues/96) | Non-ASCII draft subjects not encoded | Drafts built with MailComposer (RFC 2047) | Fixed |
|
|
424
|
+
| [#102](https://github.com/codefuturist/email-mcp/issues/102) | Replies stack "Re: RE:" and "Fwd: FW:" | Any case and common locales (AW, SV, WG) recognised | Open |
|
|
425
|
+
| [#116](https://github.com/codefuturist/email-mcp/issues/116) | Sent copy rejected by strict servers (bare LF) | Line endings normalised to CRLF before APPEND | Open |
|
|
426
|
+
|
|
427
|
+
Upstream status was read from upstream's source, not from whether the issue
|
|
428
|
+
is closed: most of these issues are still open on GitHub even where the code
|
|
429
|
+
has been fixed.
|
|
423
430
|
|
|
424
431
|
Plus fixes with no upstream issue: chunked UID fetches for large mailboxes,
|
|
425
432
|
visible login-failure reasons, STARTTLS reaching the IMAP client, OAuth2 in the
|
|
@@ -494,6 +501,8 @@ Ported from upstream: the [TLS servername repair](https://github.com/codefuturis
|
|
|
494
501
|
and [`config validate`](https://github.com/codefuturist/email-mcp/commit/bf09dcc1f087279812fe307647bf8e52198becd8).
|
|
495
502
|
Thanks also to everyone who filed the upstream issues listed above.
|
|
496
503
|
|
|
504
|
+
Adapted from [Mailoo](https://github.com/Bitfloo/mailoo) by Bitfloo (LGPL-3.0-or-later): the plain-text login guard, credential redaction in error text, and the tool catalog baseline test. See [NOTICE](NOTICE).
|
|
505
|
+
|
|
497
506
|
## License
|
|
498
507
|
|
|
499
508
|
[LGPL-3.0-or-later](LICENSE), the same license as upstream.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,gBAAgB;;;;;;iBAM3B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;iBAoB3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;iBAiB7B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0C5B,CAAC;AAEL,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB;;;iBAInC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;iBAI9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;iBAMhC,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;iBAIzB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;iBAQ7B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwB5B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;iBAqB5B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuDzB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiD9B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AACnE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/config/schema.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Zod schemas for configuration validation.
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
+
import { isLoopbackHost, LOOPBACK_HOSTS_TEXT } from '../utils/loopback.js';
|
|
5
6
|
export const ImapConfigSchema = z.object({
|
|
6
7
|
host: z.string().min(1, 'IMAP host is required'),
|
|
7
8
|
port: z.number().int().min(1).max(65535).default(993),
|
|
@@ -65,7 +66,27 @@ export const AccountConfigSchema = z
|
|
|
65
66
|
})
|
|
66
67
|
// Boolean() rather than a ?? chain: ?? short-circuits on non-nullish, so a
|
|
67
68
|
// leftover `password = ""` would swallow a valid password_command.
|
|
68
|
-
.refine((data) => Boolean(data.password) || Boolean(data.password_command) || Boolean(data.oauth2), { message: 'Either password_command, password or oauth2 config is required' })
|
|
69
|
+
.refine((data) => Boolean(data.password) || Boolean(data.password_command) || Boolean(data.oauth2), { message: 'Either password_command, password or oauth2 config is required' })
|
|
70
|
+
// The login crosses this connection; with neither TLS nor STARTTLS only a
|
|
71
|
+
// loopback host keeps it on the machine.
|
|
72
|
+
// Adapted from Mailoo (https://github.com/Bitfloo/mailoo, commit f537225),
|
|
73
|
+
// Copyright (c) 2026 Bitfloo, LGPL-3.0-or-later.
|
|
74
|
+
.superRefine((account, ctx) => {
|
|
75
|
+
[
|
|
76
|
+
['imap', 'IMAP'],
|
|
77
|
+
['smtp', 'SMTP'],
|
|
78
|
+
].forEach(([protocol, label]) => {
|
|
79
|
+
const { host, tls, starttls } = account[protocol];
|
|
80
|
+
// A blank host already carries its own issue.
|
|
81
|
+
if (!tls && !starttls && host.trim() !== '' && !isLoopbackHost(host)) {
|
|
82
|
+
ctx.addIssue({
|
|
83
|
+
code: 'custom',
|
|
84
|
+
path: [protocol, 'tls'],
|
|
85
|
+
message: `Account ${JSON.stringify(account.name)}: ${label} to ${JSON.stringify(host)} would be unencrypted (tls = false and starttls = false). Set tls = true or starttls = true, or use a loopback host (${LOOPBACK_HOSTS_TEXT}).`,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
69
90
|
export const WatcherConfigSchema = z.object({
|
|
70
91
|
enabled: z.boolean().default(false),
|
|
71
92
|
folders: z.array(z.string()).default(() => ['INBOX']),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,uBAAuB,CAAC;IAChD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC;IACrD,GAAG,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;CACtC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CA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K;YACpB,aAAa,EAAE,EAAE;YACjB,sBAAsB,EAAE,EAAE;YAC1B,gBAAgB,EAAE,IAAI;SACvB;KACF,CAAC,CACH;IACD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,kCAAkC,CAAC;CAClF,CAAC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A server's reply to a failed login can quote what the client sent: the password, the OAuth2
|
|
3
|
+
* access token, or the SASL blob that carried them. Error text from a connection goes through
|
|
4
|
+
* here before it is printed, returned by a tool or logged.
|
|
5
|
+
*/
|
|
6
|
+
import type { AccountConfig } from '../types/index.js';
|
|
7
|
+
export declare const REDACTED = "[redacted]";
|
|
8
|
+
export declare const MAX_ERROR_TEXT_LENGTH = 300;
|
|
9
|
+
export interface SentCredentials {
|
|
10
|
+
user: string;
|
|
11
|
+
secrets: readonly (string | undefined)[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Text that holds a short shape anywhere is withheld whole, and so is text whose pieces around a
|
|
15
|
+
* cut spell a secret with the marker between (a secret `AA[redacted]ZZ` around a cut token).
|
|
16
|
+
* Redacts before capping: a cut through a secret would leave a prefix no shape matches.
|
|
17
|
+
*/
|
|
18
|
+
export declare function redactSentCredentials(text: string, sent: SentCredentials): string;
|
|
19
|
+
/**
|
|
20
|
+
* nodemailer's EAUTH carries the server line in `message` and `response`, imapflow's in
|
|
21
|
+
* `response` and `responseText`; callers print, return, audit or queue `message`. `response`,
|
|
22
|
+
* `responseText` and `cause` stay off on purpose.
|
|
23
|
+
*
|
|
24
|
+
* imapflow words every refused LOGIN or AUTHENTICATE as "Command failed", so that message is
|
|
25
|
+
* rebuilt from the refusal flag, the tagged NO or BAD and, only when it is a registered one, the
|
|
26
|
+
* response code, leaving out the server's free text. imapflow's own AuthenticationFailure
|
|
27
|
+
* ("Already logged out", Exchange's "Authentication failed") sets the flag without a tagged
|
|
28
|
+
* status and keeps its message.
|
|
29
|
+
*/
|
|
30
|
+
export declare function redactedError(err: unknown, sent: SentCredentials): Error;
|
|
31
|
+
/**
|
|
32
|
+
* What a login for this account put on the wire: the user plus every secret that could be quoted
|
|
33
|
+
* back in a server's error reply (password, OAuth2 access and refresh token, client secret).
|
|
34
|
+
* Not part of the upstream file: Mailoo tracks issued tokens in its own auth module, while this
|
|
35
|
+
* fork reads the access token cached on the account's oauth2 config.
|
|
36
|
+
*/
|
|
37
|
+
export declare function sentCredentials(account: AccountConfig): SentCredentials;
|
|
38
|
+
//# sourceMappingURL=credential-redaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-redaction.d.ts","sourceRoot":"","sources":["../../src/connections/credential-redaction.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEvD,eAAO,MAAM,QAAQ,eAAe,CAAC;AAErC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAOzC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;CAC1C;AAsID;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,MAAM,CAsBjF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,GAAG,KAAK,CA+BxE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAUvE"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Adapted from Mailoo (https://github.com/Bitfloo/mailoo, commit f537225), Copyright (c) 2026 Bitfloo, LGPL-3.0-or-later.
|
|
2
|
+
/**
|
|
3
|
+
* A server's reply to a failed login can quote what the client sent: the password, the OAuth2
|
|
4
|
+
* access token, or the SASL blob that carried them. Error text from a connection goes through
|
|
5
|
+
* here before it is printed, returned by a tool or logged.
|
|
6
|
+
*/
|
|
7
|
+
export const REDACTED = '[redacted]';
|
|
8
|
+
export const MAX_ERROR_TEXT_LENGTH = 300;
|
|
9
|
+
const TRUNCATION_MARKER = '…';
|
|
10
|
+
// Matches the OAuth token-endpoint redaction.
|
|
11
|
+
const SECRET_SHAPE_MIN_CHARS = 8;
|
|
12
|
+
// RFC 6750 b64token.
|
|
13
|
+
const BEARER_TOKEN = /\bBearer\s+([\w.~+/-]+=*)/giu;
|
|
14
|
+
// Every XOAUTH2 blob is longer than this.
|
|
15
|
+
const BASE64_RUN = /[A-Za-z0-9+/]{20,}={0,2}/gu;
|
|
16
|
+
const XOAUTH2_BEARER = 'auth=Bearer ';
|
|
17
|
+
// RFC 5530 §3. imapflow's `getStatusCode` uppercases the response code and keeps only its first
|
|
18
|
+
// atom, so the sent-credential shapes cannot see a secret a server put there, whole or cut. A
|
|
19
|
+
// fixed vocabulary keeps any other server-chosen text out of the message too.
|
|
20
|
+
const REGISTERED_RESPONSE_CODES = new Set([
|
|
21
|
+
'UNAVAILABLE',
|
|
22
|
+
'AUTHENTICATIONFAILED',
|
|
23
|
+
'AUTHORIZATIONFAILED',
|
|
24
|
+
'EXPIRED',
|
|
25
|
+
'PRIVACYREQUIRED',
|
|
26
|
+
'CONTACTADMIN',
|
|
27
|
+
'NOPERM',
|
|
28
|
+
'INUSE',
|
|
29
|
+
'EXPUNGEISSUED',
|
|
30
|
+
'CORRUPTION',
|
|
31
|
+
'SERVERBUG',
|
|
32
|
+
'CLIENTBUG',
|
|
33
|
+
'CANNOT',
|
|
34
|
+
'LIMIT',
|
|
35
|
+
'OVERQUOTA',
|
|
36
|
+
'ALREADYEXISTS',
|
|
37
|
+
'NONEXISTENT',
|
|
38
|
+
]);
|
|
39
|
+
function base64(value) {
|
|
40
|
+
return Buffer.from(value, 'utf8').toString('base64');
|
|
41
|
+
}
|
|
42
|
+
function exactPattern(text) {
|
|
43
|
+
return text.replace(/[\\^$.*+?()[\]{}|]/gu, '\\$&');
|
|
44
|
+
}
|
|
45
|
+
function hexDigitsInEitherCase(percentEscape) {
|
|
46
|
+
return percentEscape.replace(/[A-F]/gu, (digit) => `[${digit}${digit.toLowerCase()}]`);
|
|
47
|
+
}
|
|
48
|
+
/** Encoders write an escape's hex digits in uppercase and an echo can write each in either case. */
|
|
49
|
+
function percentEncodedPattern(encoded) {
|
|
50
|
+
return exactPattern(encoded).replace(/%[0-9A-F]{2}/gu, hexDigitsInEitherCase);
|
|
51
|
+
}
|
|
52
|
+
/** A shape's length is that of the text it matches, not of its pattern, whose escapes are longer. */
|
|
53
|
+
function secretShapes(sent) {
|
|
54
|
+
const lengths = new Map();
|
|
55
|
+
sent.secrets
|
|
56
|
+
.filter((secret) => typeof secret === 'string' && secret.length > 0)
|
|
57
|
+
.forEach((secret) => {
|
|
58
|
+
[
|
|
59
|
+
secret,
|
|
60
|
+
// AUTH LOGIN
|
|
61
|
+
base64(secret),
|
|
62
|
+
// AUTH PLAIN, without and with an authorization identity
|
|
63
|
+
base64(`\0${sent.user}\0${secret}`),
|
|
64
|
+
base64(`${sent.user}\0${sent.user}\0${secret}`),
|
|
65
|
+
// XOAUTH2
|
|
66
|
+
base64(`user=${sent.user}\u0001auth=Bearer ${secret}\u0001\u0001`),
|
|
67
|
+
].forEach((shape) => {
|
|
68
|
+
lengths.set(exactPattern(shape), shape.length);
|
|
69
|
+
});
|
|
70
|
+
// encodeURIComponent throws on a lone surrogate; U+FFFD is what UTF-8 put on the wire for it.
|
|
71
|
+
const encoded = encodeURIComponent(secret.replace(/\p{Cs}/gu, '\uFFFD'));
|
|
72
|
+
lengths.set(percentEncodedPattern(encoded), encoded.length);
|
|
73
|
+
});
|
|
74
|
+
const shapes = { long: [], short: [] };
|
|
75
|
+
lengths.forEach((length, pattern) => {
|
|
76
|
+
shapes[length < SECRET_SHAPE_MIN_CHARS ? 'short' : 'long'].push(new RegExp(pattern, 'u'));
|
|
77
|
+
});
|
|
78
|
+
return shapes;
|
|
79
|
+
}
|
|
80
|
+
/** A lookahead match is empty, so the scan steps on one character and finds overlapping echoes. */
|
|
81
|
+
function echoesOf(text, shape) {
|
|
82
|
+
const scan = new RegExp(`(?=(${shape.source}))`, 'gu');
|
|
83
|
+
return Array.from(text.matchAll(scan), (match) => [match.index, match.index + (match[1] ?? '').length]);
|
|
84
|
+
}
|
|
85
|
+
function bearerSpans(text) {
|
|
86
|
+
return [...text.matchAll(BEARER_TOKEN)].map((match) => {
|
|
87
|
+
const end = match.index + match[0].length;
|
|
88
|
+
return [end - (match[1] ?? '').length, end];
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/** Catches an XOAUTH2 blob whose token the caller never saw, such as one nodemailer refreshed. */
|
|
92
|
+
function xoauth2BlobSpans(text) {
|
|
93
|
+
return [...text.matchAll(BASE64_RUN)]
|
|
94
|
+
.filter((match) => Buffer.from(match[0], 'base64').toString('latin1').includes(XOAUTH2_BEARER))
|
|
95
|
+
.map((match) => [match.index, match.index + match[0].length]);
|
|
96
|
+
}
|
|
97
|
+
function mergeSpans(spans) {
|
|
98
|
+
return [...spans]
|
|
99
|
+
.sort((a, b) => a[0] - b[0])
|
|
100
|
+
.reduce((merged, [start, end]) => {
|
|
101
|
+
const last = merged.at(-1);
|
|
102
|
+
if (last && start <= last[1]) {
|
|
103
|
+
last[1] = Math.max(last[1], end);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
merged.push([start, end]);
|
|
107
|
+
}
|
|
108
|
+
return merged;
|
|
109
|
+
}, []);
|
|
110
|
+
}
|
|
111
|
+
function capped(text) {
|
|
112
|
+
if (text.length <= MAX_ERROR_TEXT_LENGTH)
|
|
113
|
+
return text;
|
|
114
|
+
return `${text.slice(0, MAX_ERROR_TEXT_LENGTH - TRUNCATION_MARKER.length)}${TRUNCATION_MARKER}`;
|
|
115
|
+
}
|
|
116
|
+
function insideAMarker([start, end], markers) {
|
|
117
|
+
return markers.some((at) => at <= start && end <= at + REDACTED.length);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Text that holds a short shape anywhere is withheld whole, and so is text whose pieces around a
|
|
121
|
+
* cut spell a secret with the marker between (a secret `AA[redacted]ZZ` around a cut token).
|
|
122
|
+
* Redacts before capping: a cut through a secret would leave a prefix no shape matches.
|
|
123
|
+
*/
|
|
124
|
+
export function redactSentCredentials(text, sent) {
|
|
125
|
+
const shapes = secretShapes(sent);
|
|
126
|
+
if (shapes.short.some((shape) => shape.test(text)))
|
|
127
|
+
return REDACTED;
|
|
128
|
+
const spans = mergeSpans([
|
|
129
|
+
...shapes.long.flatMap((shape) => echoesOf(text, shape)),
|
|
130
|
+
...bearerSpans(text),
|
|
131
|
+
...xoauth2BlobSpans(text),
|
|
132
|
+
]);
|
|
133
|
+
// Spans index the original text, so one marker cannot form or split another match.
|
|
134
|
+
let redacted = '';
|
|
135
|
+
let cursor = 0;
|
|
136
|
+
const markers = [];
|
|
137
|
+
spans.forEach(([start, end]) => {
|
|
138
|
+
redacted += text.slice(cursor, start);
|
|
139
|
+
markers.push(redacted.length);
|
|
140
|
+
redacted += REDACTED;
|
|
141
|
+
cursor = end;
|
|
142
|
+
});
|
|
143
|
+
redacted += text.slice(cursor);
|
|
144
|
+
const spelled = [...shapes.long, ...shapes.short].flatMap((shape) => echoesOf(redacted, shape));
|
|
145
|
+
if (spelled.some((echo) => !insideAMarker(echo, markers)))
|
|
146
|
+
return REDACTED;
|
|
147
|
+
return capped(redacted);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* nodemailer's EAUTH carries the server line in `message` and `response`, imapflow's in
|
|
151
|
+
* `response` and `responseText`; callers print, return, audit or queue `message`. `response`,
|
|
152
|
+
* `responseText` and `cause` stay off on purpose.
|
|
153
|
+
*
|
|
154
|
+
* imapflow words every refused LOGIN or AUTHENTICATE as "Command failed", so that message is
|
|
155
|
+
* rebuilt from the refusal flag, the tagged NO or BAD and, only when it is a registered one, the
|
|
156
|
+
* response code, leaving out the server's free text. imapflow's own AuthenticationFailure
|
|
157
|
+
* ("Already logged out", Exchange's "Authentication failed") sets the flag without a tagged
|
|
158
|
+
* status and keeps its message.
|
|
159
|
+
*/
|
|
160
|
+
export function redactedError(err, sent) {
|
|
161
|
+
if (!(err instanceof Error))
|
|
162
|
+
return new Error(redactSentCredentials(String(err), sent));
|
|
163
|
+
const { code, responseCode, command, authenticationFailed, responseStatus, serverResponseCode } = err;
|
|
164
|
+
let { message } = err;
|
|
165
|
+
if (authenticationFailed === true && (responseStatus === 'NO' || responseStatus === 'BAD')) {
|
|
166
|
+
message = 'Login refused by the server';
|
|
167
|
+
if (serverResponseCode && REGISTERED_RESPONSE_CODES.has(serverResponseCode)) {
|
|
168
|
+
message += ` (${serverResponseCode})`;
|
|
169
|
+
}
|
|
170
|
+
// This fork keeps the server's own reason ("application-specific password required",
|
|
171
|
+
// "web login required"): it is often the only thing that tells a user how to fix the
|
|
172
|
+
// login. The whole message passes through redactSentCredentials below, so a secret the
|
|
173
|
+
// server quotes back is still scrubbed.
|
|
174
|
+
const { responseText } = err;
|
|
175
|
+
const reason = typeof responseText === 'string' ? responseText.replace(/^\[[^\]]*\]\s*/, '').trim() : '';
|
|
176
|
+
if (reason)
|
|
177
|
+
message += `: ${reason}`;
|
|
178
|
+
}
|
|
179
|
+
return Object.assign(new Error(redactSentCredentials(message, sent)), {
|
|
180
|
+
code,
|
|
181
|
+
responseCode,
|
|
182
|
+
command,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* What a login for this account put on the wire: the user plus every secret that could be quoted
|
|
187
|
+
* back in a server's error reply (password, OAuth2 access and refresh token, client secret).
|
|
188
|
+
* Not part of the upstream file: Mailoo tracks issued tokens in its own auth module, while this
|
|
189
|
+
* fork reads the access token cached on the account's oauth2 config.
|
|
190
|
+
*/
|
|
191
|
+
export function sentCredentials(account) {
|
|
192
|
+
return {
|
|
193
|
+
user: account.username,
|
|
194
|
+
secrets: [
|
|
195
|
+
account.password,
|
|
196
|
+
account.oauth2?.accessToken,
|
|
197
|
+
account.oauth2?.refreshToken,
|
|
198
|
+
account.oauth2?.clientSecret,
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=credential-redaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-redaction.js","sourceRoot":"","sources":["../../src/connections/credential-redaction.ts"],"names":[],"mappings":"AAAA,0HAA0H;AAC1H;;;;GAIG;AAIH,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC;AAErC,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AAEzC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,8CAA8C;AAC9C,MAAM,sBAAsB,GAAG,CAAC,CAAC;AAgBjC,qBAAqB;AACrB,MAAM,YAAY,GAAG,8BAA8B,CAAC;AAEpD,0CAA0C;AAC1C,MAAM,UAAU,GAAG,4BAA4B,CAAC;AAEhD,MAAM,cAAc,GAAG,cAAc,CAAC;AAEtC,gGAAgG;AAChG,8FAA8F;AAC9F,8EAA8E;AAC9E,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC;IAC7D,aAAa;IACb,sBAAsB;IACtB,qBAAqB;IACrB,SAAS;IACT,iBAAiB;IACjB,cAAc;IACd,QAAQ;IACR,OAAO;IACP,eAAe;IACf,YAAY;IACZ,WAAW;IACX,WAAW;IACX,QAAQ;IACR,OAAO;IACP,WAAW;IACX,eAAe;IACf,aAAa;CACd,CAAC,CAAC;AAEH,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAChC,OAAO,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E,OAAO,IAAI,KAAK,kBAAkB,GAAG,CAAC;QACxC,CAAC;QACD,qFAAqF;QACrF,qFAAqF;QACrF,uFAAuF;QACvF,wCAAwC;QACxC,MAAM,EAAE,YAAY,EAAE,GAAG,GAAyC,CAAC;QACnE,MAAM,MAAM,GACV,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5F,IAAI,MAAM;YAAE,OAAO,IAAI,KAAK,MAAM,EAAE,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,EAAE;QACpE,IAAI;QACJ,YAAY;QACZ,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,QAAQ;QACtB,OAAO,EAAE;YACP,OAAO,CAAC,QAAQ;YAChB,OAAO,CAAC,MAAM,EAAE,WAAW;YAC3B,OAAO,CAAC,MAAM,EAAE,YAAY;YAC5B,OAAO,CAAC,MAAM,EAAE,YAAY;SAC7B;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/connections/manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAmB,WAAW,EAAE,MAAM,YAAY,CAAC;AAK/D,OAAO,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources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CAAC,IAAI,CAAC,CAE5D;IAMD,OAAa,QAAQ,CACnB,OAAO,EAAE,aAAa,EACtB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC;QACT,OAAO,EAAE,OAAO,CAAC;QACjB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KACjD,CAAC,CA2ED;IAED,OAAa,QAAQ,CACnB,OAAO,EAAE,aAAa,EACtB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAwB/C;IAMK,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAsB9B;CACF"}
|
|
@@ -10,6 +10,7 @@ import nodemailer from 'nodemailer';
|
|
|
10
10
|
import { mcpLog } from '../logging.js';
|
|
11
11
|
import eventBus from '../services/event-bus.js';
|
|
12
12
|
import { createImapClient } from '../utils/imap-client.js';
|
|
13
|
+
import { redactedError, sentCredentials } from './credential-redaction.js';
|
|
13
14
|
/**
|
|
14
15
|
* Attach `error`/`close` listeners to an ImapFlow client.
|
|
15
16
|
*
|
|
@@ -23,10 +24,12 @@ import { createImapClient } from '../utils/imap-client.js';
|
|
|
23
24
|
* Listeners are attached BEFORE `connect()`, because a TLS or auth failure can
|
|
24
25
|
* emit during the connect handshake itself.
|
|
25
26
|
*
|
|
27
|
+
* @param account the account the client belongs to; its secrets are scrubbed from logged errors
|
|
26
28
|
* @param onDead runs on error or close, for callers that pool the client and
|
|
27
29
|
* need to evict it. Short-lived clients pass nothing.
|
|
28
30
|
*/
|
|
29
|
-
function attachImapLifecycleHandlers(client,
|
|
31
|
+
function attachImapLifecycleHandlers(client, account, onDead) {
|
|
32
|
+
const label = account.name;
|
|
30
33
|
const handleDead = (reason) => {
|
|
31
34
|
// Logging must never throw from inside an error handler.
|
|
32
35
|
mcpLog('warning', 'imap', `IMAP connection lost for "${label}": ${reason}`).catch(() => {
|
|
@@ -35,7 +38,8 @@ function attachImapLifecycleHandlers(client, label, onDead) {
|
|
|
35
38
|
onDead?.();
|
|
36
39
|
};
|
|
37
40
|
client.on('error', (err) => {
|
|
38
|
-
|
|
41
|
+
// The server's error text can quote the login; scrub it before it is logged.
|
|
42
|
+
handleDead(redactedError(err, sentCredentials(account)).message);
|
|
39
43
|
});
|
|
40
44
|
client.on('close', () => {
|
|
41
45
|
onDead?.();
|
|
@@ -127,13 +131,18 @@ export default class ConnectionManager {
|
|
|
127
131
|
// Evict only if this exact client is still the pooled one. A newer client
|
|
128
132
|
// may already have replaced it, and deleting unconditionally would drop a
|
|
129
133
|
// live connection.
|
|
130
|
-
attachImapLifecycleHandlers(client,
|
|
134
|
+
attachImapLifecycleHandlers(client, account, () => {
|
|
131
135
|
if (this.imapClients.get(accountName) === client) {
|
|
132
136
|
this.imapClients.delete(accountName);
|
|
133
137
|
this.imapClientCreatedAt.delete(accountName);
|
|
134
138
|
}
|
|
135
139
|
});
|
|
136
|
-
|
|
140
|
+
try {
|
|
141
|
+
await client.connect();
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
throw redactedError(err, sentCredentials(account));
|
|
145
|
+
}
|
|
137
146
|
await mcpLog('info', 'imap', `Connected to ${account.imap.host}:${account.imap.port} for "${accountName}"`);
|
|
138
147
|
this.imapClients.set(accountName, client);
|
|
139
148
|
this.imapClientCreatedAt.set(accountName, Date.now());
|
|
@@ -211,7 +220,13 @@ export default class ConnectionManager {
|
|
|
211
220
|
auth = { user: account.username, pass: account.password };
|
|
212
221
|
}
|
|
213
222
|
const transport = nodemailer.createTransport(ConnectionManager.buildSmtpTransportOptions(account, auth));
|
|
214
|
-
|
|
223
|
+
try {
|
|
224
|
+
await transport.verify();
|
|
225
|
+
}
|
|
226
|
+
catch (err) {
|
|
227
|
+
transport.close();
|
|
228
|
+
throw redactedError(err, sentCredentials(account));
|
|
229
|
+
}
|
|
215
230
|
await mcpLog('info', 'smtp', `Connected to ${account.smtp.host}:${account.smtp.port} for "${accountName}"`);
|
|
216
231
|
this.smtpTransports.set(accountName, transport);
|
|
217
232
|
return transport;
|
|
@@ -270,7 +285,7 @@ export default class ConnectionManager {
|
|
|
270
285
|
});
|
|
271
286
|
// Not pooled, so nothing to evict — but the listener still has to exist
|
|
272
287
|
// or a mid-probe socket error crashes the process during setup.
|
|
273
|
-
attachImapLifecycleHandlers(client, account
|
|
288
|
+
attachImapLifecycleHandlers(client, account);
|
|
274
289
|
await client.connect();
|
|
275
290
|
const mailboxes = await client.list();
|
|
276
291
|
let messageCount = 0;
|
|
@@ -312,7 +327,7 @@ export default class ConnectionManager {
|
|
|
312
327
|
catch (err) {
|
|
313
328
|
return {
|
|
314
329
|
success: false,
|
|
315
|
-
error: err
|
|
330
|
+
error: redactedError(err, sentCredentials(account)).message,
|
|
316
331
|
};
|
|
317
332
|
}
|
|
318
333
|
finally {
|
|
@@ -344,7 +359,7 @@ export default class ConnectionManager {
|
|
|
344
359
|
catch (err) {
|
|
345
360
|
return {
|
|
346
361
|
success: false,
|
|
347
|
-
error: err
|
|
362
|
+
error: redactedError(err, sentCredentials(account)).message,
|
|
348
363
|
};
|
|
349
364
|
}
|
|
350
365
|
finally {
|