Independent Submission K. Murchison Internet-Draft FastMail Intended status: Standards Track February 20, 2020 Expires: August 23, 2020 JMAP for Sieve Scripts draft-murchison-jmap-sieve-00 Abstract This document specifies a data model for managing Sieve scripts on a server using JMAP. Open Issues o Should setting isActive==true on a script automatically deactivate any other existing active script, or should the client have to do so itself (as is currently documented)? o Do we want/need a SieveScript/copy method? o Do we want to leverage draft-ietf-jmap-quotas to query Sieve script storage quotas? Status of This Memo 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 August 23, 2020. Copyright Notice Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved. Murchison Expires August 23, 2020 [Page 1] Internet-Draft JMAP Sieve February 2020 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 Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 1.2. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 1.3. Addition to the Capabilities Object . . . . . . . . . . . 3 1.3.1. urn:ietf:params:jmap:sieve . . . . . . . . . . . . . 3 2. Sieve Scripts . . . . . . . . . . . . . . . . . . . . . . . . 4 2.1. SieveScript/get . . . . . . . . . . . . . . . . . . . . . 5 2.2. SieveScript/set . . . . . . . . . . . . . . . . . . . . . 5 2.3. SieveScript/validate . . . . . . . . . . . . . . . . . . 5 3. Security Considerations . . . . . . . . . . . . . . . . . . . 6 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 4.1. JMAP Capability Registration for "sieve" . . . . . . . . 6 5. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 6 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 6 6.1. Normative References . . . . . . . . . . . . . . . . . . 7 6.2. Informative References . . . . . . . . . . . . . . . . . 7 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 8 1. Introduction JMAP ([RFC8620] - JSON Meta Application Protocol) is a generic protocol for synchronizing data, such as mail, calendars or contacts, between a client and a server. It is optimized for mobile and web environments, and aims to provide a consistent interface to different data types. This specification defines a data model for managing Sieve [RFC5228] scripts on a server using JMAP. The data model is designed to allow a server to provide consistent access to the same scripts via ManageSieve [RFC5804] as well as JMAP, however the functionality offered over the two protocols may differ. Murchison Expires August 23, 2020 [Page 2] Internet-Draft JMAP Sieve February 2020 1.1. Notational Conventions 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. Type signatures, examples, and property descriptions in this document follow the conventions established in Section 1.1 of [RFC8620]. Data types defined in the core specification are also used in this document. 1.2. Terminology The same terminology is used in this document as in the core JMAP specification, see [RFC8620], Section 1.6. The term SieveScript (with this specific capitalization) is used to refer to the data type defined in this document and instances of those data types. 1.3. Addition to the Capabilities Object The capabilities object is returned as part of the JMAP Session object; see [RFC8620], Section 2. This document defines one additional capability URI. 1.3.1. urn:ietf:params:jmap:sieve This represents support for the SieveScript data type and associated API methods. The value of this property in the JMAP Session capabilities property is an empty object. The value of this property in an account's accountCapabilities property is an object that MUST contain the following information on server capabilities: o *maxNumberRedirects*: "UnsignedInt|null" The maximum number of Sieve "redirect" actions a script can perform during a single evaluation (see [RFC5804], Section 1.7), or "null" for no limit. o *maxNumberScripts*: "UnsignedInt|null" The maximum number of Sieve scripts the server is willing to store for the user, or "null" for no limit. Murchison Expires August 23, 2020 [Page 3] Internet-Draft JMAP Sieve February 2020 o *maxSizeScript*: "UnsignedInt|null" The maximum size (in octets) of a Sieve script the server is willing to store for the user, or "null" for no limit. o *sieveExtensions*: "String[]" A list of Sieve extensions (as listed in Sieve "require" action [RFC5228], Section 3.2) supported by the Sieve engine. o *notificationMethods*: "String[]|null" A list of URI schema parts [RFC3986] for notification methods supported by the Sieve "enotify" extension [RFC5435], or "null" if the extension is not supported by the Sieve engine. o *externalLists*: "String[]|null" A list of URI schema parts [RFC3986] for externally stored list types supported by the Sieve "extlists" extension [RFC6134], or "null" if the extension is not supported by the Sieve engine. 2. Sieve Scripts A *SieveScript* object represents a single script on the server and has the following properties: o *id*: "Id" (immutable; server-set) The id of the script. o *name*: "String" The user-visible name for the script, subject to the requirements in [RFC5804], Section 1.6. o *content*: "String" The Sieve code in the script. Note that any double (") quote or backslash (\) characters appearing in the script content MUST be escaped by prefixing them with a backslash (\). o *isActive*: "Boolean" (default: false) Is this the user's active script? Example (using the Imap4Flags [RFC5232] Extension): { "id": "665c423a-6991-4733-8c7c-52b299572c66", "name": "example.siv", "content": "require [ \"imap4flags\" ];\r\nkeep :flags \"\\\\flagged\";", "isActive": false } Murchison Expires August 23, 2020 [Page 4] Internet-Draft JMAP Sieve February 2020 2.1. SieveScript/get This is a standard "/get" method as described in [RFC8620], Section 5.1. The _ids_ argument may be "null" to fetch all at once. This method provides similar functionality to the GETSCRIPT and LISTSCRIPTS commands in [RFC5804]. 2.2. SieveScript/set This is a standard "/set" method as described in [RFC8620], Section 5.3. This method provides similar functionality to the PUTSCRIPT, DELETESCRIPT, RENAMESCRIPT, and SETACTIVE commands in [RFC5804]. Per [RFC5804], Section 1.4, a user may have multiple Sieve scripts on the server, yet only one script may be active. Therefore, when changing the active script, the call to this method MUST both set the _isActive_ argument on the currently active script to "false" and set it to "true" on the script to be activated. The following extra SetError type is defined: For "create" and "update": o *scriptIsActive*: The "isActive" argument was true and the user already has another active script. The SetError object SHOULD also include the *id* property of the currently active script. 2.3. SieveScript/validate This method is used by the client to verify Sieve script validity without storing the script on the server. The method provides similar functionality to the CHECKSCRIPT command in [RFC5804]. The server MUST check the submitted script for syntactic validity, which includes checking that all Sieve extensions mentioned in Sieve script "require" statement(s) are supported by the Sieve interpreter. (Note that if the Sieve interpreter supports the Sieve "ihave" extension [RFC5463], any unrecognized/unsupported extension mentioned in the "ihave" test MUST NOT cause the syntactic validation failure.) The *SieveScript/validate* method takes the following arguments: o *accountId*: "Id" The id of the account to use. Murchison Expires August 23, 2020 [Page 5] Internet-Draft JMAP Sieve February 2020 o *content*: "String" The Sieve code to validate. Note that any double (") quote or backslash (\) characters appearing in the script content MUST be escaped by prefixing them with a backslash (\). The response has the following arguments: o *accountId*: "Id" The id of the account used for this call. o *isValid*: "Boolean" Is the Sieve code valid? o *errorDescription*: "String" A description of the error to show to the user, or an empty string if the Sieve code is valid. 3. Security Considerations All security considerations of JMAP [RFC8620] apply to this specification. 4. IANA Considerations 4.1. JMAP Capability Registration for "sieve" IANA will register the "sieve" JMAP Capability as follows: Capability Name: "urn:ietf:params:jmap:sieve" Specification document: this document Intended use: common Change Controller: IETF Security and privacy considerations: this document, Section XXX 5. Acknowledgments The concepts in this document are based largely on those in [RFC5804]. The author would like to thank the authors of that document for providing both inspiration and some borrowed text for this document. 6. References Murchison Expires August 23, 2020 [Page 6] Internet-Draft JMAP Sieve February 2020 6.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, January 2005, . [RFC5228] Guenther, P., Ed. and T. Showalter, Ed., "Sieve: An Email Filtering Language", RFC 5228, DOI 10.17487/RFC5228, January 2008, . [RFC5435] Melnikov, A., Ed., Leiba, B., Ed., Segmuller, W., and T. Martin, "Sieve Email Filtering: Extension for Notifications", RFC 5435, DOI 10.17487/RFC5435, January 2009, . [RFC5804] Melnikov, A., Ed. and T. Martin, "A Protocol for Remotely Managing Sieve Scripts", RFC 5804, DOI 10.17487/RFC5804, July 2010, . [RFC6134] Melnikov, A. and B. Leiba, "Sieve Extension: Externally Stored Lists", RFC 6134, DOI 10.17487/RFC6134, July 2011, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . [RFC8620] Jenkins, N. and C. Newman, "The JSON Meta Application Protocol (JMAP)", RFC 8620, DOI 10.17487/RFC8620, July 2019, . 6.2. Informative References [RFC5232] Melnikov, A., "Sieve Email Filtering: Imap4flags Extension", RFC 5232, DOI 10.17487/RFC5232, January 2008, . [RFC5463] Freed, N., "Sieve Email Filtering: Ihave Extension", RFC 5463, DOI 10.17487/RFC5463, March 2009, . Murchison Expires August 23, 2020 [Page 7] Internet-Draft JMAP Sieve February 2020 Author's Address Kenneth Murchison Fastmail US LLC 1429 Walnut Street - Suite 1201 Philadelphia, PA 19102 USA Email: murch@fastmailteam.com Murchison Expires August 23, 2020 [Page 8]