IMAP: OAuth sign-in sends an initial response without checking SASL-IR
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- swift
- Domain
- authentication, networking
Research direction
Start in IMAPClient.authenticate and compare the .plain branch, which already checks SASL-IR before using AuthenticateCommand, with the .oauthbearer and .xoauth2 branches, which only check the AUTH= capability. Add a .saslIR check to both OAuth branches that throws IMAPError.capabilityNotSupported when it is missing. Done when a server without SASL-IR produces that error and a server with it still signs in.
Written by the indexing model from the issue text.
Description
Summary
With the work for #535, IMAPClient.authenticate sends an XOAUTH2 or OAUTHBEARER credential on the AUTHENTICATE line after checking only that the mechanism is advertised. It doesn't check SASL-IR, the capability that allows a response on that line at all.
(Found by reading the code.)
Details
The .plain branch checks SASL-IR before using AuthenticateCommand. The .oauthbearer and .xoauth2 branches check AUTH=OAUTHBEARER or AUTH=XOAUTH2 and nothing else. There is also no path for a server without SASL-IR, where the response has to be sent after the server's empty challenge.
Gmail isn't affected: the capability list in Google's XOAUTH2 document includes SASL-IR.
Expected behavior
Without SASL-IR, the client either refuses to sign in and names the missing capability, or uses the exchange without an initial response: send AUTHENTICATE <mechanism>, wait for the empty challenge, then send the response on its own line.
Suggested fix
Check .saslIR in both OAuth branches and throw IMAPError.capabilityNotSupported when it's missing. Supporting the exchange without an initial response can follow if a provider needs it.
References
- RFC 4959, section 3: "clients that implement this extension MUST NOT send an initial client response to servers that do not advertise the SASL-IR capability."
- RFC 4959, section 3: "If either the client or the server do not support the SASL-IR capability, a mechanism which uses an initial client response is negotiated using the challenge/response exchange described in [RFC3501], with an initial zero-length server challenge."
In thunderbird-android
RealImapConnection.authenticatethrowsMissingCapabilityExceptionwhenSASL-IRis missing.- Test:
open() AUTH OAUTHBEARER with SASL-IR capability missing.
Links are pinned to ac1f0e8.
- Dominant language
- Swift
- Stars
- 1.3k
- Forks
- 51
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 33
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from thunderbird/thunderbird-ios
-
Account: Authorization's description returns the stored credential, including the refresh tokenOpen
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
thunderbird/thunderbird-ios#666 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
thunderbird/thunderbird-ios#664 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thunderbird/thunderbird-ios#658 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
thunderbird/thunderbird-ios#647 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
thunderbird/thunderbird-ios#644 ·
Maintainers usually reply within 1 day
All issues in thunderbird/thunderbird-ios
Similar issues
-
enhancement help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
heysidhant/appvanish#4 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
timfraedrich/OutRun#121 ·
-
deferred tooling
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
mauwii/pokerchipcase#157 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100