Repository navigation
fix(deps): restore IMAP ingest by unpinning linkify-it from mailparser - #3382
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3376.
IMAP ingest works again.
imap-smtp.get_messagethrew on every message for every mailbox, soconversation.sync_mailboximported nothing on any self-hosted instance reading mail over IMAP.Why
The root
overridesforcedlinkify-it6.1.0 on every consumer.mailparserpins 5.x and calls the module as a function (mail-parser.js:15):linkify-it 6 is a dual ESM/CJS build. Under
requireit resolves to a namespace object, not a callable, somailparserthrew while still loading andget_messagenever 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
successon every pass, and onlyoutput.inbound.reasonnamed the failure.What changed
Deleting the override alone would have reintroduced a high-severity ReDoS, in the component that parses attacker-controlled mail:
The override was a deliberate remediation, not a stray bump.
[email protected]pins linkify-it 5.0.2, which is patched for both, so:services/platform/package.json: mailparser 3.9.12 to 3.9.28.package.json: drop thelinkify-itoverride.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
nodemailer10.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.tsimports 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 transitiverequirewhilemail-parser.jswas 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.tsstays 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.