This document specifies a data model for managing Sieve
scripts on a server using the JSON Meta Application Protocol
(JMAP).
Clients can use this protocol to efficiently search, access,
organize, and validate Sieve scripts.¶
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by
the Internet Engineering Steering Group (IESG). Further
information on Internet Standards is available in Section 2 of
RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://www.rfc-editor.org/info/rfc9661.¶
Copyright (c) 2024 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.¶
The JSON Meta Application Protocol (JMAP) [RFC8620]
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 it aims to
provide a consistent interface to different data types.¶
This specification defines a data model for managing
Sieve scripts [RFC5228] 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.¶
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].
This document also uses data types and terminology established
in Sections 1.2 through 1.6 of
[RFC8620].¶
The term "SieveScript" (with this specific capitalization) is
used to refer to the data type defined in Section 2
and instances of this data type used throughout this document.
Servers MUST support all properties specified for the
data type defined in this document.¶
For brevity, JMAP API examples
(see Section 3 of [RFC8620])
only show the "methodCalls" property of the "Request"
object and the "methodResponses" property of the "Response"
object.
All other examples are shown using the
HTTP/1.1 protocol [RFC9112].¶
The "capabilities" object is returned as part of the JMAP
Session object;
see [RFC8620], Section 2.
This document defines one additional capability URI.¶
The urn:ietf:params:jmap:sieve URI represents support for
the SieveScript data type and associated API methods.
The value of this property in the JMAP Session
"capabilities" property is an object that MUST contain
the following information on server capabilities:¶
The name and version of the Sieve implementation.¶
The value of this property in an account's
"accountCapabilities" property is an object that MUST contain
the following information on per-account server capabilities:¶
The maximum length, in octets, allowed for the
name of a SieveScript.
For compatibility with ManageSieve, this MUST be at
least 512 (up to 128 Unicode characters).¶
The maximum number of Sieve "redirect" actions a
script can perform during a single evaluation,
or null for no limit.
Note that this is different from the total number of
"redirect" actions a script can contain.¶
A list of case-sensitive Sieve capability strings (as
listed in the Sieve "require" action; see
[RFC5228], Section 3.2)
indicating the extensions supported by the Sieve engine.¶
String|null
(optional; default is server dependent)¶
User-visible name for the SieveScript.
If non-null, this MUST be a
Net-Unicode string [RFC5198]
of at least 1 character in length, subject to the
maximum size given in the "capability" object.¶
For compatibility with ManageSieve, servers MUST reject
names that contain any of the following Unicode characters:
U+0000-U+001F, U+007F-U+009F, U+2028, or U+2029.¶
Servers MAY reject names that violate server policy
(e.g., names containing a slash (/)).¶
The name MUST be unique among all SieveScripts within an
account.¶
Indicator that the SieveScript is actively filtering
incoming messages.¶
A user may have at most one active script.
The SieveScript/set method (Section 2.4) is
used for changing the active script or disabling Sieve
processing.¶
A script MUST be UTF-8 content [RFC3629]
of at least 1 character in length, subject to the
syntax of Sieve [RFC5228].
A script MUST NOT contain any "require" statement(s)
mentioning Sieve capability strings not present in the
"capability" object (Section 1.2.1).
Note that if the Sieve "ihave" capability string [RFC5463]
is present in the "capability" object,
the script MAY mention unrecognized/unsupported extensions
in the "ihave" test.¶
Script content is treated as a binary blob and
uploaded/downloaded via the mechanisms provided in
Sections 6.1 and 6.2 of [RFC8620],
respectively, and/or via the JMAP Blob management methods provided in
Sections 4.1 and 4.2 of [RFC9404],
respectively.¶
Downloading script content via the JMAP downloadUrl or the
Blob/get method provides functionality equivalent to that of the
GETSCRIPT command defined in [RFC5804].¶
The id of the SieveScript to activate if and
only if all of the creations, modifications, and
destructions (if any) succeed.
(For references to SieveScript creations, this is
equivalent to a creation-reference, so the id will be the
creation id prefixed with a "#".)
The currently active SieveScript (if any) will be deactivated
before activating the specified SieveScript.¶
If omitted, or if the id is either invalid or nonexistent, it MUST be
ignored, and the currently active SieveScript (if any) will
remain as such.¶
The id of any activated SieveScript MUST be reported in
either the "created" or "updated" argument in the response
as appropriate, including a value of "true" for the "isActive"
property.
The id of any deactivated SieveScript MUST be reported in
the "updated" argument in the response, including a value of
"false" for the "isActive" property.¶
If "true", the currently active
SieveScript (if any) will be deactivated if and only if
all of the creations, modifications, and destructions (if
any) succeed.
If "false" or omitted, the currently active SieveScript (if
any) will remain as such.¶
The id of any deactivated SieveScript MUST be reported in
the "updated" argument in the response, including a value of
"false" for the "isActive" property.¶
If both the "onSuccessActivateScript" and
"onSuccessDeactivateScript" arguments are
present in the request, then
"onSuccessDeactivateScript" MUST be processed first.
If neither argument is present in the request, the currently
active SieveScript (if any) will remain as such.¶
This method provides functionality equivalent to that of the
PUTSCRIPT, DELETESCRIPT, RENAMESCRIPT, and SETACTIVE commands defined
in [RFC5804].¶
Script content must first be uploaded as per
Section 2.2 prior to referencing it in a
SieveScript/set call.¶
If the SieveScript cannot be created or updated because it
would result in two SieveScripts with the same name, the
server MUST reject the request with an "alreadyExists"
SetError.
An "existingId" property of type "Id" MUST be included on the
SetError object with the id of the existing SieveScript.¶
If the SieveScript cannot be created or updated because
its size exceeds the "maxSizeScript" limit, the server MUST
reject the request with a "tooLarge" SetError.¶
If the SieveScript cannot be created because it would
exceed the "maxNumberScripts" limit or would exceed a
server-imposed storage limit, the server MUST
reject the request with an "overQuota" SetError.¶
The active SieveScript MUST NOT be destroyed
unless it is first deactivated in a separate SieveScript/set
method call.¶
The SieveScript content violates the
Sieve grammar [RFC5228],
and/or one
or more extensions mentioned in the script's "require"
statement(s) are not supported by the Sieve interpreter.
The "description" property on
the SetError object SHOULD contain a specific error
message giving at least the line number of the first error.¶
Create and activate
a script using the uploaded blob.
Note that the response shows that an existing active
script has been deactivated in lieu of the newly
created script being activated.¶
This is a standard "/query" method as described in
[RFC8620], Section 5.5.
A "FilterCondition" object has the
following properties, either of which may be omitted:¶
Servers SHOULD impose quotas on Sieve scripts to prevent
malicious users from exceeding available storage.
Administration of such quotas is outside of the scope of this
specification; however, [RFC9425] defines a data
model for users to obtain quota details over JMAP.¶
The mechanism for handling SieveScript requests that would place
a user over a quota setting is discussed in Section 2.4.¶
Section 8 of [RFC8621] defines a
"VacationResponse" object to represent an autoresponder to
incoming email messages.
Servers that implement the VacationResponse as a Sieve script
that resides among other user scripts are subject to the
following requirements:¶
MUST allow the VacationResponse Sieve script to be
activated or deactivated via the "onSuccessActivateScript" argument to
the SieveScript/set method (Section 2.4).¶
MUST NOT allow the VacationResponse Sieve script to be
destroyed or have its content updated by the
SieveScript/set method (Section 2.4).
Any such request MUST be rejected with a "forbidden" SetError.
A "description" property MAY be present with an explanation
that the script can only be modified by a VacationResponse/set
method.¶
All security considerations discussed in
JMAP [RFC8620]
and Sieve [RFC5228]
apply to this specification.¶
Additionally, implementations MUST treat Sieve script content
as untrusted data. As such, script parsers MUST fail gracefully
in the face of syntactically invalid or malicious content and
MUST be prepared to deal with resource exhaustion (e.g.,
allocation of enormous strings, lists, or command blocks).¶
The SieveScript violates the
Sieve grammar [RFC5228], and/or one
or more extensions mentioned in the script's "require"
statement(s) are not supported by the Sieve interpreter.¶
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, , <https://www.rfc-editor.org/info/rfc2119>.
Melnikov, A., Ed., Leiba, B., Ed., Segmuller, W., and T. Martin, "Sieve Email Filtering: Extension for Notifications", RFC 5435, DOI 10.17487/RFC5435, , <https://www.rfc-editor.org/info/rfc5435>.
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, , <https://www.rfc-editor.org/info/rfc8174>.
Jenkins, N. and C. Newman, "The JSON Meta Application Protocol (JMAP) for Mail", RFC 8621, DOI 10.17487/RFC8621, , <https://www.rfc-editor.org/info/rfc8621>.
Melnikov, A., Ed. and T. Martin, "A Protocol for Remotely Managing Sieve Scripts", RFC 5804, DOI 10.17487/RFC5804, , <https://www.rfc-editor.org/info/rfc5804>.
[RFC9112]
Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP/1.1", STD 99, RFC 9112, DOI 10.17487/RFC9112, , <https://www.rfc-editor.org/info/rfc9112>.
[RFC9404]
Gondwana, B., Ed., "JSON Meta Application Protocol (JMAP) Blob Management Extension", RFC 9404, DOI 10.17487/RFC9404, , <https://www.rfc-editor.org/info/rfc9404>.
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.¶
The author would also like to thank the following
individuals for contributing their ideas and support for
writing this specification: Joris Baum, Mauro De Gennaro,
Bron Gondwana, Neil Jenkins, Alexey Melnikov, and Ricardo Signes.¶