idnits 2.17.1 draft-freed-sieve-in-xml-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** It looks like you're using RFC 3978 boilerplate. You should update this to the boilerplate described in the IETF Trust License Policy document (see https://trustee.ietf.org/license-info), which is required now. -- Found old boilerplate from RFC 3978, Section 5.1 on line 15. -- Found old boilerplate from RFC 3978, Section 5.5, updated by RFC 4748 on line 1008. -- Found old boilerplate from RFC 3979, Section 5, paragraph 1 on line 1019. -- Found old boilerplate from RFC 3979, Section 5, paragraph 2 on line 1026. -- Found old boilerplate from RFC 3979, Section 5, paragraph 3 on line 1032. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- == No 'Intended status' indicated for this document; assuming Proposed Standard Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust Copyright Line does not match the current year == Line 529 has weird spacing: '...herwise messa...' == Line 535 has weird spacing: '...en file it in...' -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (February 25, 2008) is 5898 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) No issues found here. Summary: 2 errors (**), 0 flaws (~~), 4 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group N. Freed 3 Internet-Draft S. Vedam 4 Expires: August 28, 2008 Sun Microsystems 5 February 25, 2008 7 Sieve Email Filtering: Sieves and display directives in XML 8 draft-freed-sieve-in-xml-01 10 Status of this Memo 12 By submitting this Internet-Draft, each author represents that any 13 applicable patent or other IPR claims of which he or she is aware 14 have been or will be disclosed, and any of which he or she becomes 15 aware will be disclosed, in accordance with Section 6 of BCP 79. 17 Internet-Drafts are working documents of the Internet Engineering 18 Task Force (IETF), its areas, and its working groups. Note that 19 other groups may also distribute working documents as Internet- 20 Drafts. 22 Internet-Drafts are draft documents valid for a maximum of six months 23 and may be updated, replaced, or obsoleted by other documents at any 24 time. It is inappropriate to use Internet-Drafts as reference 25 material or to cite them other than as "work in progress." 27 The list of current Internet-Drafts can be accessed at 28 http://www.ietf.org/ietf/1id-abstracts.txt. 30 The list of Internet-Draft Shadow Directories can be accessed at 31 http://www.ietf.org/shadow.html. 33 This Internet-Draft will expire on August 28, 2008. 35 Abstract 37 This document describes a way to represent Sieve email filtering 38 language scripts in XML. Representing sieves in XML is intended not 39 as an alternate storage format for Sieve but rather as a means to 40 facilitate manipulation of scripts using XML tools. 42 The XML representation also defines additional elements that have no 43 counterparts in the regular Sieve language. These elements are 44 intended for use by graphical user interfaces and provide facilities 45 for labeling or grouping sections of a script so they can be 46 displayed more conveniently. These elements are represented as 47 specially structured comments in regular Sieve format. 49 Change History (to be removed prior to publication as an RFC 51 Changed representation of comments in XML to use a comment element. 53 Updatde references. 55 Table of Contents 57 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 58 2. Conventions used in this document . . . . . . . . . . . . . . 4 59 3. Grammatical structure of Sieve . . . . . . . . . . . . . . . . 4 60 4. XML Representation of Sieve . . . . . . . . . . . . . . . . . 5 61 4.1. XML Display Directives . . . . . . . . . . . . . . . . . . 7 62 5. Extended Example . . . . . . . . . . . . . . . . . . . . . . . 8 63 6. Security Considerations . . . . . . . . . . . . . . . . . . . 13 64 7. References . . . . . . . . . . . . . . . . . . . . . . . . . . 13 65 7.1. Normative References . . . . . . . . . . . . . . . . . . . 13 66 7.2. Informative References . . . . . . . . . . . . . . . . . . 13 67 Appendix A. Schema for Sieves in XML . . . . . . . . . . . . . . 14 68 Appendix B. Stylesheet for conversion from XML . . . . . . . . . 16 69 Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 21 70 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 22 71 Intellectual Property and Copyright Statements . . . . . . . . . . 23 73 1. Introduction 75 Sieve [RFC5228] is a language for filtering email messages at or 76 around the time of final delivery. It is designed to be 77 implementable on either a mail client or mail server. It is meant to 78 be extensible, simple, and independent of access protocol, mail 79 architecture, and operating system and it is intended to be 80 manipulated by a variety of different user interfaces. 82 Some user interface environments have extensive existing facilities 83 for manipulating material represented in XML. While adding support 84 for alternate data syntaxes may be possible in most if not all of 85 these environments, it may not be particularly convenient to do so. 86 The obvious way to deal with this issue is to map sieves into XML, 87 possibly on a separate backend system, manipulate the XML, and 88 convert it back to normal Sieve format. 90 The fact that conversion into and out of XML may be done as a 91 separate operation on a different system argues strongly for defining 92 a common XML representation for Sieve. This way different front end 93 user interfaces can be used with different back end mapping and 94 storage facilities. 96 Another issue with the creation and manipulation of sieve scripts by 97 user interfaces is that the language is strictly focused on 98 describing email filtering operations. The language contains no 99 mechanisms for indicating how a given script should be presented in a 100 user interface. Such information can be represented in XML very 101 easily so it makes sense to define a framework to do this as part of 102 the XML format. Structured comments can then be used to retain this 103 information when the script is converted to normal Sieve format. 105 Various sieve extensions have already been defined, e.g., [RFC5229] 106 [RFC5230] [RFC5231] [RFC5232] [RFC5233] [RFC5235], and many more are 107 planned. The set of extensions available varies from one 108 implementation to the next and may even change as a result of 109 configuration choices. It is therefore essential that the XML 110 representation of Sieve be able to accommodate Sieve extensions 111 without requiring schema changes. It is also desirable that Sieve 112 extensions not require changes to the code that converts to and from 113 the XML representation. 115 This specification defines an XML representation for sieve scripts 116 and explains how the conversion process to and from XML works. The 117 XML representation is capable of accommodating any future Sieve 118 extension as long as the underlying Sieve grammar remains unchanged. 119 Furthermore, code that converts from XML to the normal Sieve format 120 requires no changes to accommodate extensions, while code used to 121 convert from normal Sieve format to XML only requires changes when 122 new control commands are added - a rare event. An XML Schema and 123 sample code to convert to and from XML format are also provided in 124 the appendices. 126 2. Conventions used in this document 128 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 129 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 130 document are to be interpreted as described in RFC 2119 [RFC2119]. 132 3. Grammatical structure of Sieve 134 The Sieve language is designed to be highly extensible without making 135 any changes to the basic language syntax. Accordingly the syntax of 136 Sieve, defined in section 8 of [RFC5228], is entirely structural in 137 nature and employs no reserved words of any sort. 139 Structurally a sieve script consists of a series of commands. Each 140 command in turn consists of an identifier, zero or more arguments, a 141 optional test or test-list, and finally an optional block containing 142 another series of commands. Commands are further broken down into 143 controls and actions, although this distinction cannot be determined 144 from the grammar. 146 Some example Sieve controls are: 148 stop; <-- No arguments, test, or command block 149 require "fileinto"; <-- Control with a single argument 150 if true {stop;} <-- Control with test and command block 152 Some examples of Sieve actions are: 154 discard; <-- Action with no args, test, or command block 155 fileinto "folder"; <-- Action with an argument 157 At the time of this writing there are no controls defined that accept 158 both arguments and a test. Similarly, there are currently no defined 159 actions that allow either a test or a command block. Nevertheless, 160 the Sieve grammar allows such constructs to be defined by some future 161 extension. 163 A test consists of an identifier followed by zero or more arguments, 164 then another test or test-list. Unlike commands, tests cannot be 165 followed by a command block. 167 Here are some examples of Sieve tests. Note that such tests have to 168 appear as part of a command in order to be syntactically valid: 170 true <-- Test with no argument or subordinate test 171 header "to" "me@example.com" <-- Test with several arguments 173 Command or test arguments can be either string lists, whole numbers 174 or tags. (Tags are simply identifiers preceded by a colon.) Note 175 that although the Sieve grammar treats single strings as a degenerate 176 case of a string list, some tests or actions have arguments that can 177 only be individual strings, not lists. 179 Here is an example showing the use of both a test-list and a string 180 list: 182 if anyof (not exists ["From", "Date"], 183 header :contains "from" "fool@example.edu") { 184 discard; 185 } 187 Extensions can add new controls, actions, tests, or new arguments to 188 existing controls or actions. Extensions can also change how string 189 content is interpreted, although this is not relevant to this 190 specification. However, it is especially important to note that so 191 far no Sieve extension has added a new control to the language and it 192 seems safe to assume that due to their nature future addition of 193 controls will be rare. 195 Finally, comments are allowed between lexical elements in a Sieve 196 script. It is very important that comments be preserved in the XML 197 representation. 199 4. XML Representation of Sieve 201 Sieve controls and actions are represented in XML as control or 202 action elements respectively. The command's identifier appears as a 203 name attribute on the element itself. This is the only attribute 204 allowed on controls and actions - arguments, tests, test-lists, and 205 nest command blocks are all represented as nested elements. While 206 naming the element after the control or action itself may seem like a 207 better choice, doing so would result in extensions changing the XML 208 schema. 210 The example Sieve controls shown in the previous section would be 211 represented in XML as: 213 214 fileinto 215 216 217 219 The example Sieve actions shown above would appear in XML as: 221 222 folder 224 The separation of controls from actions in the XML representation 225 means that conversion from normal Sieve format to XML has to be able 226 to distinguish between controls and actions. This is easily done by 227 maintaining a list of all known controls since experience indicates 228 new controls are rarely added. 230 Tests are represented in the same basic way as controls and actions, 231 that is, as a test element with a name attribute giving the test 232 identifier. For example: 234 235 tome@example.com 237 String, number, and tag arguments are represented as str, num, and 238 tag elements respectively. The actual string, number, or tag 239 identifier appears as text inside the element. None of these 240 elements have any defined attributes. Several examples of arguments 241 have already appeared in the preceding control, action and test 242 examples. 244 String list arguments are represented as a list element which in turn 245 contains one or more str elements. Note that this allows the 246 distinction between a single string and a string list containing a 247 single string to be preserved. This is not essential since a list 248 containing a single string could simply be mapped to a string, but it 249 seems prudent to maintain the distinction when mapping to and from 250 XML. 252 Nested command blocks appear as a series of control or action 253 elements inside of an outer control or action element. No block 254 element is needed since an inner command block can only appear once 255 and only after any arguments, tests, or test-lists. For example: 257 259 260 265 contains 266 from 267 fool@example.edu 268 269 270 271 273 Finally, Sieve comments are mapped to a special comment element in 274 XML. XML comments are not used because some XML tools do not make it 275 convenient to access comment nodes. 277 4.1. XML Display Directives 279 Sometimes graphical user interfaces are a convenient way to provide 280 sieve management functions to users. These interfaces typically 281 summarize/annotate/group/display sieve script(s) in an intuitive way 282 for end users. 284 To do this effectively, the graphical user interface may require 285 additional information about the sieve script itself. That 286 information or "meta-data" might include, but is not limited to - a 287 sieve name (identifying the current sieve), whether the sieve is 288 enabled or disabled, the order in which the part of the sieve are 289 presented to the user. The graphical user interface may also choose 290 to provide mechanisms to allow the user to modify the script. 292 It is often useful for a graphical user interface to group related 293 sieve script elements and provide an interface that display these 294 groups separately so they can be managed as a single object. Some 295 examples include Sieve statements that together provide vacation 296 responders, blacklists/whitelists and other types of filtering 297 controls. 299 Some advanced graphical user interfaces may even provide a natural 300 language representation of a sieve script and/or an advanced 301 interface to present sieve statements directly to the user. 303 A graphical user interface may also choose to support only a subset 304 of action commands in the Sieve language (and its extensions) and so 305 a mechanism to indicate the extent of support and characterize the 306 relationships between those supported action commands and test (with 307 its arguments) is immensely useful and probably required for clients 308 that may not have complete knowledge of sieve grammar and semantics. 310 The Sieve language contains no mechanisms for indicating how a given 311 script should be presented in a user interface. The language also 312 does not contain any specific mechanisms to represent other sorts of 313 meta-data about the script. Providing support for such meta-data as 314 part of a sieve script is currently totally implementation specific 315 and is usually done by imposing some type of structure on comments. 317 However, such information can be represented in XML very easily so it 318 makes sense to define a framework to do this as part of the XML 319 format. Implementations may choose to use structured comments to 320 retain this information when the script is converted to normal Sieve 321 format. 323 This XML representation defines two display directives - displayblock 324 and displaydata - as containers for meta-data needed by graphical 325 user interfaces. 327 The displayblock element can be used to enclose any number of sieve 328 statements at any level. It is semantically meaningless to the sieve 329 script itself. It allows an arbitrary set of attributes. 330 Implementations MAY use this to provide many simple, display related 331 meta-data for the sieve such as sieve identifier, group identifier, 332 order of processing, etc. This information SHOULD be preserved in 333 structured comments during conversion of XML to the normal Sieve 334 syntax. 336 The displaydata element supports any number of arbitrary child 337 elements. Implementations MAY use this to represent complex data 338 about that sieve such as a natural language representation of sieve 339 or a way to provide the sieve script directly. Again, this 340 information SHOULD be preserved in structured comments when 341 converted. 343 5. Extended Example 345 The example sieve script given in section 9 of [RFC5228] would be 346 represented in XML as follows: 348 349 350 Example Sieve Filter 351 Declare any optional features or extensions used by the script 353 355 356 fileinto 357 359 360 Handle messages from known mailing lists 361 Move messages from IETF filter discussion list to filter mailbox 362 363 364 365 is 366 Sender 367 owner-ietf-mta-filters@imc.org 368 369 370 filter 371 move to "filter" mailbox 372 374 375 Keep all messages to or from people in my company 376 377 378 379 domain 380 is 381 382 From 383 To 384 385 example.com 386 387 388 390 391 Try and catch unsolicited email. If a message is not to me, 392 or it contains a subject known to be spam, file it away. 393 394 395 396 397 398 all 399 contains 400 401 To 402 Cc 403 Bcc 404 405 me@example.com 406 407 408 409 matches 410 subject 411 412 *make*money*fast* 413 *university*dipl*mas* 414 415 416 417 418 spam 419 420 421 422 423 Move all other (non-company) mail to "personal" 424 mailbox. 425 426 427 personal 428 429 431 433 The same script could be annotated with graphical display hints in a 434 variety of ways. Two possibilities are: 436 438 439 fileinto 440 442 444 445 446 is 447 Sender 448 owner-ietf-mta-filters@imc.org 450 451 452 filter 453 454 455 457 459 460 461 domain 462 is 463 464 From 465 To 466 467 example.com 468 469 470 471 473 475 476 477 478 479 all 480 contains 481 482 To 483 Cc 484 Bcc 485 486 me@example.com 487 488 489 490 matches 491 subject 492 493 *make*money*fast* 494 *university*dipl*mas* 495 496 497 498 499 spam 500 501 502 504 506 507 508 personal 509 510 511 513 515 Note that since displayblock elements are semantically null as far as 516 the script itself is concerned they can be used to group structures 517 like elsif and else that are tied to statements in other groups. 519 521 522 523 If the e-mail header "Sender" is owner-ietf-mta-filters@imc.org 524 then file it into the "filter" folder. 526 Otherwise if the address in the "From" or "To" has a domain 527 that is "example.com" then keep it. 529 Otherwise messages meeting with any of these conditions: 531 (1) None of the addresses in "To" or "Cc" or "Bcc" contains 532 the domain "example.com". 534 (2) The "Subject" field matches the pattern *make*money*fast* or 535 *university*dipl*mas* then file it into the "spam" folder. 537 If all else fails then file the message in the "personal" 538 folder. 539 540 542 ... the actual sieve script ... 544 546 6. Security Considerations 548 Any syntactically valid sieve script can be represented in XML. 549 Accordingly, all security considerations applicable to Sieve and any 550 extensions used also apply to the XML representation. 552 The use of XML carries its own security risks. Section 7 of RFC 3470 553 [RFC3470] discusses these risks. 555 Arbitrary data can be placed in the extensible displayblock and 556 displaydata constructs defined in this specification, possibly 557 including entire scripts in languages other than Sieve. Appropriate 558 security precautions should be taken when using these facilities. 560 7. References 562 7.1. Normative References 564 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 565 Requirement Levels", BCP 14, RFC 2119, March 1997. 567 [RFC3470] Hollenbeck, S., Rose, M., and L. Masinter, "Guidelines for 568 the Use of Extensible Markup Language (XML) 569 within IETF Protocols", BCP 70, RFC 3470, January 2003. 571 [RFC5228] Guenther, P. and T. Showalter, "Sieve: An Email Filtering 572 Language", RFC 5228, January 2008. 574 7.2. Informative References 576 [RFC5229] Homme, K., "Sieve Email Filtering: Variables Extension", 577 RFC 5229, January 2008. 579 [RFC5230] Showalter, T. and N. Freed, "Sieve Email Filtering: 580 Vacation Extension", RFC 5230, January 2008. 582 [RFC5231] Segmuller, W. and B. Leiba, "Sieve Email Filtering: 583 Relational Extension", RFC 5231, January 2008. 585 [RFC5232] Melnikov, A., "Sieve Email Filtering: Imap4flags 586 Extension", RFC 5232, January 2008. 588 [RFC5233] Murchison, K., "Sieve Email Filtering: Subaddress 589 Extension", RFC 5233, January 2008. 591 [RFC5235] Daboo, C., "Sieve Email Filtering: Spamtest and Virustest 592 Extensions", RFC 5235, January 2008. 594 Appendix A. Schema for Sieves in XML 596 The following defines a schema for the XML representation of Sieve 597 scripts. Note that aside from defining the displaydata and 598 displayblock elements this schema imposes no constraints on their 599 content. 601 603 606 607 608 609 610 611 612 613 614 615 616 617 618 620 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 644 646 647 648 649 650 651 652 653 654 655 656 658 659 660 661 663 664 665 666 668 669 670 672 674 676 678 679 680 681 682 684 685 686 687 688 689 690 691 692 693 694 695 696 697 699 700 701 702 703 704 705 707 709 Appendix B. Stylesheet for conversion from XML 711 713 715 718 721 722 723 725 728 729 732 733 734 736 737 738 739 740 741 742 743 745 746 \" 747 748 750 751 752 753 754 756 757 \\ 758 759 761 762 763 764 765 766 767 769 771 772 773 774 775 776 777 779 780 781 783 784 785 786 787 788 789 { 790 791 793 794 795 796 797 799 800 801 802 803 804 805 806 807 808 } 809 810 811 ; 812 813 814 816 817 818 819 821 822 ( 823 824 825 826 , 827 828 829 ) 830 831 832 833 " 834 835 836 837 " 838 840 841 842 843 844 845 846 G 847 848 849 850 M 851 852 853 854 K 855 856 857 858 859 860 862 863 [ 864 865 866 867 , 868 869 870 ] 871 873 874 : 875 876 878 879 880 881 882 883 /* 884 885 886 */ 887 889 890 891 892 893 894 895 /* [* 896 897 */ 898 901 902 903 904 905 906 /* *] */ 907 909 910 911 912 913 914 /* [| 915 916 918 919 920 921 922 |] */ 923 925 927 928 929 930 931 932 < 933 934 935 /> 936 938 939 940 941 942 943 < 944 945 946 > 947 948 950 951 952 953 954 955 956 </ 957 958 > 959 961 962 963 964 =" 965 966 " 967 969 971 Appendix C. Acknowledgements 973 The stylesheet copy mode code is loosely based on a sample code 974 posted to the xsl-list list by Americo Albuquerque. Andrew McKeon 975 provided useful comments on the document. 977 Authors' Addresses 979 Ned Freed 980 Sun Microsystems 981 3401 Centrelake Drive, Suite 410 982 Ontario, CA 92761-1205 983 USA 985 Phone: +1 909 457 4293 986 Email: ned.freed@mrochek.com 988 Srinivas Saisatish Vedam 989 Sun Microsystems 991 Phone: +91 80669 27577 992 Email: Srinivas.Sv@Sun.COM 994 Full Copyright Statement 996 Copyright (C) The IETF Trust (2008). 998 This document is subject to the rights, licenses and restrictions 999 contained in BCP 78, and except as set forth therein, the authors 1000 retain all their rights. 1002 This document and the information contained herein are provided on an 1003 "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS 1004 OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND 1005 THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS 1006 OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF 1007 THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED 1008 WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 1010 Intellectual Property 1012 The IETF takes no position regarding the validity or scope of any 1013 Intellectual Property Rights or other rights that might be claimed to 1014 pertain to the implementation or use of the technology described in 1015 this document or the extent to which any license under such rights 1016 might or might not be available; nor does it represent that it has 1017 made any independent effort to identify any such rights. Information 1018 on the procedures with respect to rights in RFC documents can be 1019 found in BCP 78 and BCP 79. 1021 Copies of IPR disclosures made to the IETF Secretariat and any 1022 assurances of licenses to be made available, or the result of an 1023 attempt made to obtain a general license or permission for the use of 1024 such proprietary rights by implementers or users of this 1025 specification can be obtained from the IETF on-line IPR repository at 1026 http://www.ietf.org/ipr. 1028 The IETF invites any interested party to bring to its attention any 1029 copyrights, patents or patent applications, or other proprietary 1030 rights that may cover technology that may be required to implement 1031 this standard. Please address the information to the IETF at 1032 ietf-ipr@ietf.org.