sieve
sieve is a fast and secure Sieve filter interpreter for Rust that supports all registered Sieve extensions.
Usage Example
use ;
Scripts compile to a compact bytecode. Store script.to_bytes() and load it again
with Sieve::from_bytes(&bytes), which borrows the buffer instead of copying it, so a
script can be loaded on every delivery at almost no cost. Operations that need an
asynchronous answer (list lookups, duplicate tracking, mailbox checks, external
functions, scripts loaded on demand) return Reply::Pending from the handler; the
interpreter then returns Status::Pending and continues after resume(input).
Scripts loaded while a run is in progress (include of a user script) must outlive
the Context; push them into a ScriptArena declared before the context and hand
the interpreter the reference it returns.
Testing & Fuzzing
To run the testsuite:
To fuzz the library with cargo-fuzz:
Conformed RFCs
- RFC 5228 - Sieve: An Email Filtering Language
- RFC 3894 - Copying Without Side Effects
- RFC 5173 - Body Extension
- RFC 5183 - Environment Extension
- RFC 5229 - Variables Extension
- RFC 5230 - Vacation Extension
- RFC 5231 - Relational Extension
- RFC 5232 - Imap4flags Extension
- RFC 5233 - Subaddress Extension
- RFC 5235 - Spamtest and Virustest Extensions
- RFC 5260 - Date and Index Extensions
- RFC 5293 - Editheader Extension
- RFC 5429 - Reject and Extended Reject Extensions
- RFC 5435 - Extension for Notifications
- RFC 5463 - Ihave Extension
- RFC 5490 - Extensions for Checking Mailbox Status and Accessing Mailbox Metadata
- RFC 5703 - MIME Part Tests, Iteration, Extraction, Replacement, and Enclosure
- RFC 6009 - Delivery Status Notifications and Deliver-By Extensions
- RFC 6131 - Sieve Vacation Extension: "Seconds" Parameter
- RFC 6134 - Externally Stored Lists
- RFC 6558 - Converting Messages before Delivery
- RFC 6609 - Include Extension
- RFC 7352 - Detecting Duplicate Deliveries
- RFC 8579 - Delivering to Special-Use Mailboxes
- RFC 8580 - File Carbon Copy (FCC)
- RFC 9042 - Delivery by MAILBOXID
- REGEX-01 - Regular Expression Extension (draft-ietf-sieve-regex-01)
License
Licensed under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
You can be released from the requirements of the AGPLv3 license by purchasing a commercial license. Please contact licensing@stalw.art for more details.
Copyright
Copyright (C) 2020, Stalwart Labs LLC