Closed Bug 1919244 Opened 2 months ago Closed 1 month ago

MessageHeader author field sometimes only contains last name instead of full name and email address

Categories

(Thunderbird :: Add-Ons: Extensions API, defect, P2)

Thunderbird 128

Tracking

(thunderbird_esr128 fixed)

RESOLVED FIXED
132 Branch
Tracking Status
thunderbird_esr128 --- fixed

People

(Reporter: florian.unger, Assigned: TbSync)

References

Details

Attachments

(3 files)

Attached file TB128_author_bug.eml

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36

Steps to reproduce:

In an addon I use messageDisplay API function getDisplayedMessage
to retrieve the MessageHeader of the currently displayed message.

Actual results:

For specific mails the returned MessageHeader does not have the author field correctly filled.
The author field then only contains the last name of the sender instead of full name and email address (see screenshot attached).

The error is reproducible. I attached a sample email for testing (TB128_author_bug.eml).
The email is redacted - mail body was deleted and subject changed but the error is still reproducible with this sample.

Expected results:

the author field should always contain a correct MailBoxHeaderString in format "User <user@example.com>"

Component: Untriaged → Add-Ons: Extensions API

Further details I forgot to mention.
I call function getDisplayedMessage from the background script when a button in the Message Display section is clicked:

if ("messageDisplayAction" in messenger) {
    messenger.messageDisplayAction.onClicked.addListener(async (tab) => {

        curMailviewTabId = tab.id;

        messenger.messageDisplay.getDisplayedMessage(tab.id).then(msg => {

            curMessage = msg;

        }).catch(() => {
            console.error("messageDisplayAction - messenger.messageDisplay.getDisplayedMessage failed! tab:", tab);
        });

    });
} else {
    console.error("messageDisplayAction not available in Thunderbird! This should not happen!");
}

Confirmed.

Assignee: nobody → john
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2

Oh wow, mime2DecodedRecipients and mime2DecodedAuthor do unexpected things. These are valid headers:

From: =?UTF-8?Q?H=C3=B6rst=2C_Kenny?= <K.Hoerst@invalid>
To: =?UTF-8?Q?H=C3=B6rst=2C_Kenny?= <K.Hoerst@invalid>, postmaster@gmx.de

This is what the msgHdr has in those fields:

mime2DecodedAuthor: Hörst, Kenny <K.Hoerst@invalid>
mime2DecodedRecipients: Hörst, Kenny <K.Hoerst@invalid>, postmaster@gmx.de

After doing RFC 2047 decode, the mailbox strings are invalid, the display name part should be quoted. mime2DecodedAuthor could be worked around because it is known to be a single mailbox, but mime2DecodedRecipients is unusable.

I will remove all usage of mime2DecodedAuthor and mime2DecodedRecipients from the WebExtension component.

The values in msgHdr.mime2DecodedRecipients and msgHdr.mime2DecodedAuthor
should no longer be used. They will hold invalid values, if the decoded
value includes a comma, but not the encoded value. Since the encoded
value does not need to be quoted, and the decoded mailbox string is not
auto-quoted, it becomes invalid and unusable.

Target Milestone: --- → 132 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/ca50fb74c817
Remove usage of broken mime2DecodedRecipients and mime2DecodedAuthor. r=mkmelin

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Blocks: 1921765

Comment on attachment 9426620 [details]
Bug 1919244 - Remove usage of broken mime2DecodedRecipients and mime2DecodedAuthor. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #):
User impact if declined: Values in MessageHeader.recipients can have invalid data, which cannot be processed correctly
Testing completed (on c-c, etc.): 14 days on beta
Risk to taking this patch (and alternatives if risky): Moderate. Has a test

Attachment #9426620 - Flags: approval-comm-esr128?

Comment on attachment 9426620 [details]
Bug 1919244 - Remove usage of broken mime2DecodedRecipients and mime2DecodedAuthor. r=#thunderbird-reviewers

[Triage Comment]
Approved for esr128

Attachment #9426620 - Flags: approval-comm-esr128? → approval-comm-esr128+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: