Skip to content

fix(deps): restore IMAP ingest by unpinning linkify-it from mailparser - #3382

Merged
Israeltheminer merged 1 commit into
mainfrom
fix/mailparser-linkify-it
Sep 15, 2026
Merged

Israeltheminer merged 1 commit into
mainfrom
fix/mailparser-linkify-it

Conversation

@Israeltheminer

Copy link
Copy Markdown
Contributor

Closes #3376.

IMAP ingest works again. imap-smtp.get_message threw on every message for every mailbox, so conversation.sync_mailbox imported nothing on any self-hosted instance reading mail over IMAP.

Why

The root overrides forced linkify-it 6.1.0 on every consumer. mailparser pins 5.x and calls the module as a function (mail-parser.js:15):

const linkify = require('linkify-it')();

linkify-it 6 is a dual ESM/CJS build. Under require it resolves to a namespace object, not a callable, so mailparser threw while still loading and get_message never returned.

Sending was unaffected — it uses nodemailer and never loads mailparser. That asymmetry is what hid it: the product looked healthy, the scheduled sync reported success on every pass, and only output.inbound.reason named the failure.

What changed

Deleting the override alone would have reintroduced a high-severity ReDoS, in the component that parses attacker-controlled mail:

Advisory Vulnerable Patched
GHSA-22p9-wv53-3rq4 <= 5.0.0 5.0.1
GHSA-v245-v573-v5vm <= 5.0.1 5.0.2

The override was a deliberate remediation, not a stray bump. [email protected] pins linkify-it 5.0.2, which is patched for both, so:

  1. services/platform/package.json: mailparser 3.9.12 to 3.9.28.
  2. Root package.json: drop the linkify-it override.

mailparser is the only consumer of linkify-it in the tree, so the override has nothing else to protect. The lockfile now resolves linkify-it 5.0.2 and uc.micro 2.1.0.

Risk

The bump carries sixteen patch releases of mailparser and moves its transitive pins (@zone-eu/mailsplit, libmime, iconv-lite, encoding-japanese).

One pattern to watch, because it is the same shape as this bug: mailparser 3.9.28 declares nodemailer 10.0.10, and the root override holds nodemailer at 9.1.1. That resolution loads and parses correctly today, and the new test asserts it keeps doing so — but it is another override sitting on top of a pin.

Tests

imap-smtp.runtime-deps.test.ts imports mailparser, imapflow and nodemailer and hands each to the resolver production uses, then parses a message end to end. Importing the entry is not enough — the break happened in a transitive require while mail-parser.js was still initialising, and parsing is what pulls that path in.

Restoring the override turns two of its four tests red with TypeError: require(...) is not a function, the exact production failure. imap-smtp.test.ts stays green throughout: it passes synthetic module shapes, which is the right way to test the resolvers and the reason a tree that cannot load these packages went unnoticed.

Suites: 130 connector tests, 333 across connectors and conversations, oxlint and oxfmt clean.

Scope

Fixes the dependency tree. An instance also needs #3381 before a scheduled sync starts at all — that one restores the runs, and those runs then fail here without this.

No mail could be ingested over IMAP. The root override forced linkify-it
6.1.0 on every consumer, but mailparser pins 5.x and calls
`require('linkify-it')()`. linkify-it 6 is a dual ESM/CJS build whose
`require` yields a namespace object rather than a callable, so mailparser
threw while loading and imap-smtp.get_message failed for every mailbox.

Sending was unaffected — it uses nodemailer and never loads mailparser —
so an instance looked healthy while replies stopped arriving, and the
scheduled sync reported success on every pass.

Deleting the override alone would have reintroduced a high-severity ReDoS:
GHSA-22p9-wv53-3rq4 is unpatched at or below 5.0.0 and GHSA-v245-v573-v5vm
at or below 5.0.1, and this code path parses attacker-controlled mail. The
override was a deliberate remediation. mailparser 3.9.28 pins linkify-it
5.0.2, which is patched for both, so bumping it and then dropping the
override keeps the remediation and fixes the load. mailparser is the only
consumer of linkify-it in the tree, so the override has nothing else to
protect.

imap-smtp.runtime-deps.test.ts imports the three mail libraries and hands
them to the resolvers production uses. The existing interop tests pass
synthetic module shapes, which is the right way to test the resolvers and
the reason a tree that cannot load these packages at all went unnoticed.
@Israeltheminer
Israeltheminer merged commit f6262b2 into main Sep 15, 2026
58 checks passed
@Israeltheminer
Israeltheminer deleted the fix/mailparser-linkify-it branch September 15, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IMAP ingest cannot read any message: the linkify-it override breaks mailparser

1 participant