Skip to content

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

Closed

Description

@Israeltheminer

No mail can be ingested over IMAP. imap-smtp.get_message throws on every message,
for every mailbox, so conversation.sync_mailbox imports nothing. Sending is
unaffected.

The run still reports status: success. The failure appears only inside the output:

mailboxes skipped — <name>: the live imap-smtp.get_message call failed:
require(...) is not a function

Why

Root package.json carries an override:

"overrides": { "linkify-it": "6.1.0" }

[email protected] pins linkify-it: 5.0.1 and calls the module as a function
(node_modules/mailparser/lib/mail-parser.js:15):

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

linkify-it 6 is a dual ESM/CJS build. Under require it resolves to a Module
namespace object, not a callable, so the call throws while mailparser is still
loading. get_message reaches await import('mailparser')
(services/platform/lib/connectors/natives/imap-smtp.ts:1366) and never returns.

The override forces 6.1.0 on every consumer, which stops the package manager from
nesting mailparser's own 5.0.1.

mailparser is the only package in the tree that depends on linkify-it. The
override has no other beneficiary.

Reproduce

In an empty directory:

{
  "dependencies": { "mailparser": "3.9.12" },
  "overrides": { "linkify-it": "6.1.0" }
}
npm install
node --input-type=module -e "await import('mailparser')"
TypeError: require(...) is not a function

Remove the overrides block, reinstall, and the same import succeeds. The package
manager nests [email protected] under mailparser, which is what its pin asks for.

Inside a running container:

docker exec <platform> node --input-type=module -e "await import('mailparser')"

Impact

Every self-hosted instance that ingests email over imap-smtp receives nothing.
Outbound continues to work, because send uses nodemailer and never loads
mailparser. That asymmetry is what makes it hard to spot: the product looks healthy,
replies simply never arrive.

The scheduled sync reports success on every pass, so run status is not a signal
here. The only evidence is automation_runs.output->'inbound'->>'reason'.

Suggested fix

Do not simply delete the override. linkify-it carries two high-severity advisories
that the override remediates, and mailparser parses attacker-controlled input, which
is the exact threat model for both:

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

linkify-it 5.0.2 is patched for both, and [email protected] pins exactly that
version. So:

  1. Bump mailparser to 3.9.28 in services/platform/package.json.
  2. Drop linkify-it from the root overrides. mailparser is its only consumer and
    now resolves a patched version on its own.

Verified with bun, the repo's own package manager: with the override, bun install
resolves 6.1.0 and await import('mailparser') throws. Without it, bun resolves
mailparser's pinned 5.x and the import succeeds.

Add a check that loads the native connector's runtime dependencies. A test that
imports mailparser, imapflow and nodemailer against the installed tree would
have failed the moment the override landed. The existing
lib/connectors/natives/imap-smtp.test.ts injects the transports, so it passes with a
tree that cannot load them.

Scope

This is independent of the scheduled-trigger refusal in #3377. Fixing
either alone leaves email ingest broken: the trigger fix restores the runs, and those
runs then fail here.

Activity

  1. Israeltheminer commented on Sep 15, 2026

    @Israeltheminer
    ContributorAuthor

    Correction to the original Suggested fix, which said to delete the linkify-it override and leave mailparser on 5.0.1. That would have reintroduced a high-severity ReDoS.

    linkify-it carries two advisories, and mailparser parses attacker-controlled input:

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

    So the override was a deliberate remediation, not an accidental bump. 5.0.2 is patched for both and [email protected] pins it, so bumping mailparser and then dropping the override fixes the crash without losing the security fix. The issue body now says this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions