Repository navigation
Parse MIME display names without a polynomial regex - #1357
Merged
Merged
Conversation
helpcodeai
enabled auto-merge (squash)
October 31, 2026 08:20
|
All contributors have signed the CLA ✍️ ✅ |
helpcodeai
force-pushed
the
fix/mime-address-redos
branch
from
October 31, 2026 08:25
6f87b73 to
953fe19
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Summary
CodeQL flagged
parseAddressinmime-message.util.ts(polynomial ReDoS, high): the pattern/^(.*?)\s*<([^<>]*)>$/lets the lazy group and\s*overlap, so a display name followed by a long run of spaces and no closing>is quadratic. The address comes from a tool argument, so a caller of an EMAIL connector could stall the event loop with one long string.Changes
\s*before<; the display name is trimmed right after the match, so the result is unchanged.<name@example.com>must parse in well under a second, and the same string without>is rejected as before.Type
Testing
In
packages/backend:npx jest src/connectors/engines/mime-message.util.spec.ts src/connectors/engines/rest.engine.mime.spec.ts(2 suites, 52 tests pass),npx eslinton the two files,npx tsc --noEmit -p tsconfig.json(ok). Same behaviour in Cloud and self-hosted: the EMAIL connector type uses this parser in both.Checklist
npm test)Related Issues
Code scanning alert 604.