Closed Bug 2056491 Opened 2 months ago Closed 1 month ago

SMTP username in account authentication not encoded in UTF-8

Categories

(MailNews Core :: Networking: SMTP, defect)

Thunderbird 140
defect

Tracking

(thunderbird_esr153+ affected, thunderbird156 fixed)

RESOLVED FIXED
156 Branch
Tracking Status
thunderbird_esr153 + affected
thunderbird156 --- fixed

People

(Reporter: flesueur, Assigned: mkmelin)

References

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0

Steps to reproduce:

I configured a login name with non-ascii characters on my server.

Actual results:

Authentication fails with Thunderbird.

Expected results:

Authentication should have succeeded.
Authentication works with Evolution.

According to RFC 4616 regarding the PLAIN Simple Authentication and Security Layer (SASL) Mechanism, the AUTH string containing the login and the password must be encoded with UTF-8. From what I can see on the server logs, the login from Thunderbird is encoded with latin-1. The password can be encoded with UTF-8 (that was bug #1491755) but only the password, the login is still encoded with latin-1.

Component: Untriaged → Account Manager
Flags: needinfo?(vineet)
See Also: → 1986189, 811272
Summary: SMTP authentication not encoded in UTF8 → SMTP account authentication not encoded in UTF8

(assuming this also affects 153)

Blocks: tb153found
Status: UNCONFIRMED → NEW
Ever confirmed: true

I can't even authenticate, so I can't even configure the server settings.
(see bug 1986189)

And it fails with pref mail.smtp_login_pop3_user_pass_auth_is_latin1 set to false?

For background: This pref was introduced in bug 1500772 (also see bug 1503625) since some M$ servers required latin1 at the time and utf-8 failed.

(In reply to Ótzï fón GlüϷgor from comment #2)

I can't even authenticate, so I can't even configure the server settings.
(see https://bugzilla.mozilla.org/show_bug.cgi?id=1986189)

You can try by removing the special characters at the first step (email address, which will be wrong but let's accept it). Then, without special characters in the address, you can specify the servers, logins and passwords.

(In reply to Francesco from comment #3)

And it fails with pref mail.smtp_login_pop3_user_pass_auth_is_latin1 set to false?

Yes, I tried both and it fails too, for SMTP. Yet it worked on the IMAP side (I think), but that was possibly a "counter-bug" in the server (I only studied precisely the smtp side)

From what I saw, mail.smtp_login_pop3_user_pass_auth_is_latin1 handles the password's encoding but not the login's encoding, no ?

Yes, I did not look up the IMAP spec for this auth, nor if my server (dovecot) is behaving as expected : it just works with Thunderbird and Evolution for IMAP.

Regarding SMTP :

Aha, so this is about the non-ASCII in the user name, not the password. You're correct conversion to UTF-8 is missing here:
https://searchfox.org/comm-central/rev/72b8ba0761b3881d926be53f77fbf75d5a9316d5/mailnews/compose/src/SmtpClient.sys.mjs#1064
So the username would be sent in UTF-16, which looks a lot like latin1 for the lower 256 characters.

Compare to the UTF-8 conversion for the password here:
https://searchfox.org/comm-central/rev/72b8ba0761b3881d926be53f77fbf75d5a9316d5/mailnews/compose/src/SmtpClient.sys.mjs#1096

Looks like this has been wrong for a long time.

Summary: SMTP account authentication not encoded in UTF8 → SMTP user name in account authentication not encoded in UTF-8
Version: Thunderbird 152 → Thunderbird 140

Apparently we need more tests, manual and automatic, around these types of issues. Another job for QA.

No longer blocks: tb153found
Flags: needinfo?(corey)

a couple adjacent items in https://mzl.la/3R7fG8t (I haven't attempted to narrow it down)

If this is a regression, it was regressed by the SMTP rewrite in JS. It's not an internationalisation issue, just not converting from JS/UTF-16 to UTF-8. You can trigger it using any non-ASCII character, like € or £. Sure, it surfaces when people start using "local" non-ASCII characters in usernames (or passwords).

Assignee: nobody → mkmelin+mozilla
Component: Account Manager → Networking: SMTP
Flags: needinfo?(vineet)
Flags: needinfo?(corey)
Product: Thunderbird → MailNews Core

Two bugs really: not encoding properly, and not storing the username pref value the right way.

Status: NEW → ASSIGNED
Summary: SMTP user name in account authentication not encoded in UTF-8 → SMTP username in account authentication not encoded in UTF-8
Target Milestone: --- → 156 Branch

Pushed by arschmitz@thunderbird.net:
https://hg.mozilla.org/comm-central/rev/75977b75cb66
SMTP username in account authentication not encoded in UTF-8. r=jtracey

Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED

Comment on attachment 9628530 [details]
Bug 2056491 - SMTP username in account authentication not encoded in UTF-8. r=#thunderbird-back-end-reviewers

Uplift Approval Request

  • Please state case for uplift consideration and ensure bug severity is set: Not to mess up migrations - https://bugzilla.mozilla.org/show_bug.cgi?id=2069089#c22
  • User impact if declined:
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Daily?: Yes
  • Has the fix been verified in Beta?: Yes
  • Needs manual test from QA?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Has been in the tree since 156, no regressions reported.
  • Does the fix cause any migrations to be skipped?: N/A
  • String changes made/needed: none
Attachment #9628530 - Flags: approval-comm-esr153?

How can you backport this if you're skipping bug 2044250 which also did a migration (apart from the fact that the patch won't apply)?

Right, bug 2044250 would be the odd one out...
I think we could skip that (https://hg-edge.mozilla.org/comm-central/diff/835e07554d036cdead02d7a26168f29626393441/mail/modules/MailMigrator.sys.mjs) migration for esr, and then add it back later before next esr.

Flags: needinfo?(corey)

It's a good point. How would you ensure the migration for bug 2044250 added back before the next esr? Bug 2044250 isn't really a candidate for uplift.

Flags: needinfo?(corey)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: