Internet-Draft | IMAP JMAPACCESS | March 2023 |
Gulbrandsen & Gondwana | Expires 7 September 2023 | [Page] |
This document defines an IMAP extension to let clients know that the messages in this IMAP server are also available via JMAP, and how. It is intended for clients that want to migrate gradually to JMAP.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 7 September 2023.¶
Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
A few IMAP client maintainers have asked for ways to use features that are available in JMAP without having to drop their expensively tested IMAP code.¶
This document provides a server with a way to declare that the messages in its mailstore are also available via JMAP. For simplicity, only a complete equivalence is supported (the same set of messages are available via both IMAP and JMAP).¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
By advertising the JMAPACCESS capability, the server asserts that if a mailbox or message has a particular object ID when accessed via either IMAP or JMAP (see [RFC3501], [RFC9051] and [RFC8620]), then the same mailbox or message is accessible via the other protocol, and it has the same ID.¶
The server MUST also advertise the OBJECTID extension, defined by [RFC8474]. The JMAP session resource that allows access to the same messages is called "the JMAP server" below.¶
This specification does not affect message lifetime: If a client accesses a message via IMAP and half a second later via JMAP, then the message may have been deleted.¶
When the server processes the client's LOGIN/AUTHENTICATE command and enters Authenticated state, the server considers the way the client authenticated. If the IMAP server can infer from the client's authentication process that its credentials suffice to authenticate via JMAP, then the server MUST also send an untagged OK response with a JMAPACCESS response code containing a link to the JMAP server.¶
If the credentials might not succeed with the JMAP server, then the server SHOULD send an untagged OK response with a DEBUGGING response code with a message to help client developers understand why this authentication would not work with the JMAP server.¶
Servers are encouraged to report the same message flags and other data via both protocols, as far as possible.¶
This specification does not require mailboxes to have the same name in IMAP and JMAP, even if they share mailbox ID. However, the JMAP specification regulates that, in the text about the name and role properties in [RFC8620] section 2.¶
Note that all JMAP servers support internationalized email addresses (see [RFC6530]). If this IMAP server does not, or the IMAP client does not issue ENABLE UTF8=ACCEPT (see [RFC6855]), then there is a possibility that the client receives accurate address fields via JMAP and downgraded fields via IMAP (see (see [RFC6857] and [RFC6858] for examples).¶
The JMAPACCESS response code is followed by a single link to a JMAP session resource. The server/mailstore at that location is referenced as "the JMAP server" in this document.¶
The DEBUGGING response code asserts that when used with a status response, the client may safely forward the string argument to the client maintainers. The argument MUST NOT contain any message contents or other personal information.¶
The formal syntax in [RFC9051] is extended thus:¶
resp-code-jmapaccess = "JMAPACCESS" SP (atom / quoted)¶
resp-code-debugging = "DEBUGGING" SP (atom / quoted)¶
resp-text-code =/ resp-code-jmapaccess / resp-code-debugging¶
The syntax in [RFC3501] is extended similarly (this extension may be used with IMAP4rev1 as well as IMAP4rev2).¶
Lines sent by the client are preceded by C:, lines sent by the server by S:. Each example starts with the IMAP banner issued when the client connects, and generally contains only those capabilities required by the example, omitting important but irrelevant capabilities such as STARTTLS.¶
Example 1. A client connects, sees that SASL OAUTH is available, and authenticates in that way.¶
S: * OK [CAPABILITY IMAP4rev1 AUTH=OAUTHBEARER SASL-IR] example1
C: 1 AUTHENCITATE OAUTHBEARER bixhPXVzZ...QEB¶
The server processes the command successfully. Since it knows that the client used Oauth, and that it and its JMAP alter ego use the same Oauth backend subsystem, the server infers that the (next) access token is just a usable via JMAP as via IMAP. It issues a JMAPACCESS response code in its reply:¶
S: 1 OK [JMAPACCESS https://example.com/jmap] done¶
SASL OAUTH is specified by [RFC7628], and the argument in this example is abbreviated from the more realistic length used in RFC7628.¶
Example 2. A client connects, sees no SASL method it recognises, and issues a LOGIN command.¶
S: * OK [CAPABILITY IMAP4rev1] example2
C: 2 LOGIN "arnt" "trondheim"¶
The server sees that the password is correct, knows that it and its JMAP alter ego the same password database, and issues JNAPACCESS response code:¶
S: 2 OK [JMAPACCESS "https://example.com/.s/[jmap]"] done¶
The URL is quoted since the ] character must be quoted. The URL uses the same quoting rules as most other IMAP strings.¶
Example 3. A client connects, sees no SASL method it recognises, and issues a LOGIN command with a correct password.¶
S: * OK [CAPABILITY IMAP4rev1] example3
C: 3 LOGIN "arnt" "trondheim"¶
The server operator has decided to disable password use with JMAP, but allow it for a while with IMAP to cater to older clients. The server issues a DEBUGGING response code in its reply:¶
S: 3 OK [DEBUGGING "Cleartext passwords disabled with JMAP"] done¶
The message is quoted since it contains spaces. The message uses the same quoting rules as most other IMAP strings.¶
Example 4. A client connects, sees no SASL method it recognises, and issues a LOGIN command. Its password is incorrect.¶
S: * OK [CAPABILITY IMAP4rev1 AUTH=GSS] example4
C: 4 LOGIN "arnt" "oslo"¶
The server does not enter Authenticated state, so nothing requires it to issue either JMAPACCESS or DEBUGGING. It replies curtly:¶
S: 4 NO done¶
The IANA is requested to add the JMAPACCESS and DEBUGGING response codes to the IMAP Response Codes registry.¶
This extension reveals to clients why they cannot auhenticate to the JMAP server. One normally does not want to reveal anything about why a client cannot authenticate, for fear of giving useful information to an intruder.¶
However, in this case the client has already authenticated via IMAP. By doing so the client already gained access to all of the same mail. The authors believe that the debugging value of the OK response far outweighs its security concerns.¶