JMAP for Sieve ScriptsFastmail US LLC1429 Walnut Street - Suite 1201PhiladelphiaPA19102USAmurch@fastmailteam.com
ART
Independent SubmissionJMAPJSONSieveThis document specifies a data model for managing Sieve
scripts on a server using JMAP.
How should doing /set{create} with an existing script
name be handled? Should it fail or overwrite the existing
script? Should the /set request include an 'overwrite'
boolean argument?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)?Do we want/need a SieveScript/copy method?Do we want to leverage draft-ietf-jmap-quotas to query
Sieve script storage quotas?JMAP ( – 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
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
as well as JMAP, however the
functionality offered over the two protocols may differ.
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 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 . Data types defined in the
core specification are also used in this document.
The same terminology is used in this document as in the
core JMAP specification, see , 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.
The capabilities object is returned as part of the JMAP
Session object; see , Section 2. This
document defines one additional capability URI.
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:
maxNumberRedirects:
UnsignedInt|null
The maximum number of Sieve "redirect" actions a
script can perform during a single evaluation
(see , Section 1.7),
or null for no limit.
maxNumberScripts:
UnsignedInt|null
The maximum number of Sieve scripts the server is
willing to store for the user,
or null for no limit.
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.
sieveExtensions:
String[]
A list of Sieve extensions (as listed in Sieve
"require" action , Section 3.2)
supported by the Sieve engine.
notificationMethods:
String[]|null
A list of URI schema parts
for notification methods supported by the Sieve
"enotify" extension ,
or null if the extension
is not supported by the Sieve engine.
externalLists:
String[]|null
A list of URI schema parts
for externally stored list types supported by the
Sieve "extlists" extension ,
or null if the extension
is not supported by the Sieve engine.
A SieveScript object represents
a single script on the server and has the following properties:
id:
Id
(immutable; server-set)
The id of the script.
name:
String
The user-visible name for the script, subject to the
requirements in , Section 1.6.
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 (\).
isActive:
Boolean
(default: false)
Is this the user's active script?
This is a standard "/get" method as described in
, 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 .
This is a standard "/set" method as described in
, Section 5.3.
This method provides similar functionality to the
PUTSCRIPT, DELETESCRIPT, RENAMESCRIPT, and SETACTIVE commands
in .
Per , 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":
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.
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 .
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 , any
unrecognized/unsupported extension mentioned in the "ihave"
test MUST NOT cause the syntactic validation failure.)
The SieveScript/validate method
takes the following arguments:
accountId:
Id
The id of the account to use.
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:
accountId:
Id
The id of the account used for this call.
isValid:
Boolean
Is the Sieve code valid?
errorDescription:
String
A description of the error to show to the user, or an
empty string if the Sieve code is valid.
All security considerations of JMAP
apply to this specification.
IANA will register the "sieve" JMAP Capability as follows:
Capability Name:
urn:ietf:params:jmap:sieveSpecification document: this document
Intended use: common
Change Controller: IETF
Security and privacy considerations: this document,
The following sub-section registers a new error code in the
JMAP Error Codes registry, as defined in .
JMAP Error Code: scriptIsActive Intended use: common Change controller: IETF Reference: This document, section 2.5 Description: The client tried to activate a Sieve script,
but another acript is already active.The concepts in this document are based largely on those in
.
The author would like to thank the authors of that document for
providing both inspiration and some borrowed text for this
document.Changes since -00:
Added IANA registration for "scriptIsActive" JMAP error code.Added open issue about /set{create} with an existing script name.