Closed Bug 1869122 Opened 2 years ago Closed 2 years ago

Autoconfig fails when unsupported OAuth2 is preferred authentication method

Categories

(Thunderbird :: Account Manager, defect)

Thunderbird 122
defect

Tracking

(thunderbird_esr115 fixed)

RESOLVED FIXED
123 Branch
Tracking Status
thunderbird_esr115 --- fixed

People

(Reporter: cketti, Assigned: cketti)

References

Details

Attachments

(1 file, 1 obsolete file)

FetchConfig will return a config where OAuth2 is the preferred authentication method, even when OAuth2 isn't supported with the incoming or outgoing server. Account setup will then fail with the error message "Could not get OAuth2 details for hostname=…"

Right now this is a problem for the comcast.net configuration in ISPDB. Thunderbird Daily has the necessary OAuth2 credentials for Comcast (see bug 1844810). However, we can't update the config in ISPDB because stable Thunderbird and older versions (without the necessary OAuth2 credentials) would try to use OAuth2 and fail.

My suggestion is to clean up the AccountConfig instance returned by the Autoconfig parser and strip occurrences of OAuth2 when the app doesn't support OAuth2 with the incoming or outgoing server. If there's an alternative authentication method, the app will fall back to that.

In the future this will allow providers (and ISPDB) to publish configs where OAuth2 is the preferred authentication method, even when stable or older versions of Thunderbird don't support it with that provider. Those app versions will then use a fallback authentication method or let the user know that no supported config was found.

Assignee: nobody → cketti
Status: NEW → ASSIGNED

Thanks for noticing this bug. I thought we already did that.

Yes, it was always the idea that the client would ignore the OAuth2 authentication option, if the client cannot use it, for whatever reason. That's why it's just the first and preferred option, and there is a fallback.

I will review the concrete patch later.

Review done. Waiting for revision of the patch.

Instead of processing the xml, wouldn't it be simpler to just remove a possible no-op OAuth2 config after fetching. It shouldn't be many lines to add a check, probably around here: https://searchfox.org/comm-central/rev/20293ca81e7f17705aaaf2a395210daddab44106/mail/components/accountcreation/content/accountSetup.js#817

I proposed that as well, but cketti correctly pointed out that this will break the fallback mechanisms, so this is not a good place. Details see the review in Phab.

I see. It depends a bit on how we would allow fallbacks. I think we can say, if a config file was found, it must be usable. I never saw a case where we would find two different configs.

Or, we could do such a check slightly earlier, like at https://searchfox.org/comm-central/rev/20293ca81e7f17705aaaf2a395210daddab44106/mail/components/accountcreation/content/accountSetup.js#649 so a success is never called unless it's all good.

Attachment #9368718 - Attachment description: Bug 1869122 - Part 1 - Refactor reading Autoconfig XML. r=BenB → Bug 1869122 - Part 1 - Refactor reading Autoconfig XML. r=BenB,mkmelin
Attachment #9368718 - Attachment is obsolete: true
Attachment #9367779 - Attachment description: Bug 1869122 - Ignore OAuth2 from Autoconfig when not supported with the server. r=BenB → Bug 1869122 - Ignore OAuth2 from Autoconfig when not supported with the server. r=BenB,mkmelin

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/d9bb43629625
Ignore OAuth2 from Autoconfig when not supported with the server. r=BenB,mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 123 Branch

Nice that we have a full set of tests!
Uplift to 115 after a full clean cycle of beta?

See Also: → 1844810
Flags: needinfo?(cketti)

Uplift to 115 after a full clean cycle of beta?

Sounds good to me. I don't think this will cause any problems.

Flags: needinfo?(cketti)

Comment on attachment 9367779 [details]
Bug 1869122 - Ignore OAuth2 from Autoconfig when not supported with the server. r=BenB,mkmelin

[Triage Comment]
Approved for esr115 per comment 10

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

Attachment

General

Creator:
Created:
Updated:
Size: