Repository navigation
Conversation
Author
|
Full test suite on fix/unicode-alias-username (2026-10-09)
|
The recipient local part was converted to punycode before matching, so an address like "fællestest@example.com" became "xn--fllestest-g3a" and never matched regex aliases such as /^.*llestest$/ or exact Unicode alias names, falling back to the catch-all instead. parseUsername now returns the NFC normalized, lowercase Unicode local part. Alias matching tries both the Unicode and punycode forms (via the new get-username-variants helper) so legacy "xn--" aliases keep working. Alias names and the lookup API username are NFC normalized as well. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
uniejo
force-pushed
the
fix/unicode-alias-username
branch
from
October 12, 2026 08:36
c0908ad to
8d6f0ef
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 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.
The recipient local part was converted to punycode before matching, so an address like "fællestest@example.com" became "xn--fllestest-g3a" and never matched regex aliases such as /^.*llestest$/ or exact Unicode alias names, falling back to the catch-all instead.
parseUsername now returns the NFC normalized, lowercase Unicode local part. Alias matching tries both the Unicode and punycode forms (via the new get-username-variants helper) so legacy "xn--" aliases keep working. Alias names and the lookup API username are NFC normalized as well.
Checklist
Problem
The recipient local part is converted to punycode before alias matching
(
helpers/parse-username.jsrunspunycode.toASCII()on it). An address likefællestest@example.combecomesxn--fllestest-g3a, so:/^.*llestest$/never match on the MX side(
helpers/get-forwarding-addresses.jstests the regex against the punycode form only),fællestest:…) never match either,*catch-all instead.helpers/get-forwarding-configuration.jsalready tested both forms(
regex.test(username) || regex.test(punycode.toUnicode(username))), so thepaid-plan lookup returned the right alias, but the MX side then dropped it.
Punycode is only defined for domain names. Unicode local parts belong to
SMTPUTF8 (RFC 6531), so
xn--…in the local part is a different mailbox.Separately, nothing normalizes Unicode.
blåtestwritten with a decomposedå(NFD, common on macOS) does not equal the composed (NFC) alias name.
Changes
parseUsernamereturns the NFC-normalized, lowercase Unicode local part (no punycode).helpers/get-username-variants.jsreturns the Unicode and punycode forms,so aliases created as
xn--…keep matching (backwards compatible).get-forwarding-addressesandget-forwarding-configurationmatch regex, exact,and
!/!!/!!!aliases against both forms. The legacytoUnicodefallbackquery now uses
$inwith the variants.app/models/aliases.js) and the lookup APIusernameparameter areNFC-normalized.
app/models/emails.jskeeps its ASCII conversionexplicitly, so outbound behaviour is unchanged.
Tests
test/unicode-alias-forwarding.js(12 tests) covers TXT and paid-plan mappings,regex,
$1substitution, exact, ignored, NFC/NFD, legacyxn--aliases, andASCII regressions. 9 of these fail against the current master.
Notes
A migration could normalize them in bulk.
helpers/get-recipients.js) now passes the Unicodelocal part on instead of the
xn--form.🤖 Generated with Claude Code