rfc-5463

Sieve Email Filtering: Ihave Extension

N. Freed
date2009-03 streamIETF areaapp wgsieve statusPROPOSED STANDARD pages6 canonicalhttps://www.rfc-editor.org/rfc/rfc5463 doi10.17487/RFC5463
This document describes the "ihave" extension to the Sieve email filtering language. The "ihave" extension provides a means to write scripts that can take advantage of optional Sieve features but can still run when those optional features are not available. The extension also defines a new error control command intended to be used to report situations where no combination of available extensions satisfies the needs of the script. [STANDARDS-TRACK]

Extracted elements (18)

design-rationale §4

'ihave' is prohibited from use with grammar-changing extensions (such as variables or encoded-character) because those extensions alter how script text is parsed and interpreted, making reliable run-time capability detection impossible.

email

design-rationale §4

Once an 'ihave' test for an extension succeeds, that extension may be used anywhere in the script from that point forward (not only within the 'ihave' block), mirroring the semantics of having declared it in the require clause.

email

design-rationale §5

The 'error' control is bundled with the 'ihave' extension rather than defined separately so that it is unconditionally available to scripts that use 'ihave', without requiring a separate require declaration.

email

design-rationale §1

The 'ihave' extension was created to allow scripts to take advantage of optional Sieve features when available, while still running when those features are absent. This addresses portability across environments that provide different sets of extensions — something the existing static 'require' mechanism cannot handle.

email

interoperability-note §4

An extension can appear in both the require control statement and an 'ihave' test; if the extension is implemented, it is usable throughout the script and the 'ihave' test for it will always return true, making the test redundant but not erroneous.

email

interoperability-note §4

Because 'ihave' can appear inside 'anyof', 'allof', and 'not' tests, full parse-time checking of 'ihave' is very difficult to implement; the spec acknowledges this and permits deferring all checking to run time.

email

normative-requirement §4 MUST

A run-time error MUST be generated if a script attempts to use an extension before a successful 'ihave' test for that extension has been evaluated.

email

normative-requirement §4 MUST

If any capability in the 'ihave' capabilities list is unavailable, the test fails and none of the capabilities in that list are enabled.

email

normative-requirement §4 MUST

If 'ihave' is enabled, the interpreter MUST short-circuit test evaluation (stop as soon as a result is determined) and MUST evaluate tests left to right.

email

normative-requirement §4 MUST NOT

Implementations MUST NOT allow 'ihave' to be used with extensions that change the underlying Sieve grammar or that change how script content is interpreted (e.g., encoded-character, variables). If such usage is attempted, the 'ihave' test MUST fail and the extension MUST NOT be enabled.

email

normative-requirement §5 SHOULD

The error control's message argument SHOULD be included in any generated report regarding the script error.

email

normative-requirement §4 REQUIRED

The strings in the capabilities list passed to 'ihave' must be constant strings in the context of Sieve variables (RFC 5229); it is an error to pass a non-constant string as an argument to 'ihave'.

email

normative-requirement §4 MUST

When 'ihave' is specified in the require clause, scripts MUST either defer extension-use checking to run time or take 'ihave' tests into account at parse time; normal parse-time-only checking is no longer permitted.

email

protocol-element §5

The 'error' control command causes script execution to terminate with a run-time error. Its sole argument is a UTF-8 string message describing the error condition, which SHOULD be included in any generated error report.

email

protocol-element §4

The 'ihave' test accepts a list of capability names as a string-list argument and succeeds if and only if all of those capabilities are present and available to the script. Unlike most Sieve tests, it accepts no match or comparator arguments; the match type is always ':is' and the comparator is always 'i;octet'.

email

registry §7

RFC 5463 registers the 'ihave' capability name in the IANA Sieve Extensions registry. The capability enables run-time testing for optional extension availability and the 'error' control command.

email, registry

security-consideration §6

A Sieve script that fails to run due to a missing extension may fail to block dangerous email. The 'ihave' extension improves script portability and generality, which may improve the overall security provided by Sieve filtering.

email, security

security-consideration §6

'ihave' is essentially a more flexible variant of the existing require mechanism and does not add any new capabilities to a Sieve implementation that could introduce additional security issues beyond those already present in the base specification and employed extensions.

email, security