The Sieve Mail-Filtering Language -- Extensions for Checking Mailbox Status and Accessing Mailbox Metadata
Extracted elements (18)
The metadata extensions deliberately omit any mechanism to write or modify annotations. This design choice limits what a Sieve script can do, reducing the risk of privilege escalation or data corruption through script execution.
A successful "mailboxexists" test does not guarantee that a subsequent "fileinto" action on that mailbox will succeed. For example, the action might put the user over quota; "mailboxexists" only verifies existence and delivery permission.
Annotations MUST be accessed with the permissions of the user in whose context the Sieve script runs, and annotations starting with the "/private" prefix MUST be those of the user in whose context the Sieve script runs.
For "servermetadata", annotations MUST be accessed with the permissions of the user in whose context the Sieve script runs, and annotations starting with "/private" MUST be those of the user in whose context the Sieve script runs.
Protocols and APIs used to retrieve annotations MUST provide at least the same level of confidentiality as those used to retrieve Sieve scripts. In particular, the protocol used to retrieve annotations must not lack encryption.
When ":create" is specified with "fileinto", failure to create the specified mailbox MUST be considered to be an error.
When the mailstore is an IMAP server, delivery is possible if the READ-WRITE response code is present (when IMAP ACL is not supported), or if the user has 'p' or 'i' rights for the mailbox (when IMAP ACL is supported).
The "mailboxexists" test returns true if all mailboxes listed in "mailbox-names" exist in the mailstore and each allows the user in whose context the Sieve script runs to deliver messages into it. Capability string is "mailbox".
The "metadata" test retrieves the value of the mailbox annotation "annotation-name" for mailbox "mailbox" via the IMAP METADATA extension, then compares it against "key-list". Returns true if the annotation exists and its value matches any key. Default match type is ":is" and default comparator is "i;ascii-casemap". Capability string is "mboxmetadata".
The "metadataexists" test returns true if all annotations listed in "annotation-names" exist (i.e., have non-NIL values) for the specified mailbox. Capability string is "mboxmetadata".
The optional ":create" argument to the "fileinto" command instructs the Sieve interpreter to create the specified mailbox before attempting delivery if it does not already exist. Failure to create the mailbox is treated as an error. Capability string is "mailbox".
The "servermetadata" test retrieves the value of the server annotation "annotation-name" and compares it against "key-list". Returns true if the annotation exists and its value matches any key. Default match type is ":is" and default comparator is "i;ascii-casemap". Capability string is "servermetadata".
The "servermetadataexists" test returns true if all server annotations listed in "annotation-names" exist (i.e., have non-NIL values). Capability string is "servermetadata".
IANA registered the Sieve capability "mailbox" (RFC 5490), which adds a test for checking mailbox existence and an optional ":create" argument to "fileinto" for creating a mailbox before attempting mail delivery.
IANA registered the Sieve capability "mboxmetadata" (RFC 5490), which adds tests for checking mailbox metadata item existence and for retrieving a mailbox metadata value.
IANA registered the Sieve capability "servermetadata" (RFC 5490), which adds tests for checking server metadata item existence and for retrieving a server metadata value.
A temporary failure to retrieve annotations may alter the result of Sieve processing. Implementations SHOULD treat such failures the same way they treat a temporary failure to retrieve the Sieve script itself (e.g., assume the script doesn't exist or delay delivery).
Extensions defined in this document deliberately do not provide a way to modify annotations, limiting the attack surface for Sieve scripts that access metadata.