5524
PROPOSED STANDARD
Extended URLFETCH for Binary and Converted Parts
Authors: D. Cridland
Date: May 2009
Area: app
Working Group: lemonade
Stream: IETF
Abstract
The URLFETCH command defined as part of URLAUTH provides a mechanism for third parties to gain access to data held within messages in a user's private store; however, this data is sent verbatim, which is not suitable for a number of applications. This memo specifies a method for obtaining data in forms suitable for non-mail applications. [STANDARDS-TRACK]
RFC 5524
PROPOSED STANDARD
Errata Exist
Network Working Group D. Cridland
Request for Comments: 5524 Isode Limited
Category: Standards Track May 2009
<span class="h1">Extended URLFETCH for Binary and Converted Parts</span>
Status of This Memo
This document specifies an Internet standards track protocol for the
Internet community, and requests discussion and suggestions for
improvements. Please refer to the current edition of the "Internet
Official Protocol Standards" (STD 1) for the standardization state
and status of this protocol. Distribution of this memo is unlimited.
Copyright Notice
Copyright (c) 2009 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents in effect on the date of
publication of this document (<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>).
Please review these documents carefully, as they describe your rights
and restrictions with respect to this document.
Abstract
The URLFETCH command defined as part of URLAUTH provides a mechanism
for third parties to gain access to data held within messages in a
user's private store; however, this data is sent verbatim, which is
not suitable for a number of applications. This memo specifies a
method for obtaining data in forms suitable for non-mail
applications.
<span class="grey">Cridland Standards Track [Page 1]</span>
<span id="page-2" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
Table of Contents
<a href="#section-1">1</a>. Introduction ....................................................<a href="#page-2">2</a>
<a href="#section-2">2</a>. Conventions Used in This Document ...............................<a href="#page-2">2</a>
<a href="#section-3">3</a>. Extended URLFETCH ...............................................<a href="#page-2">2</a>
<a href="#section-3.1">3.1</a>. Command Parameters .........................................<a href="#page-3">3</a>
<a href="#section-3.2">3.2</a>. Response Metadata ..........................................<a href="#page-3">3</a>
<a href="#section-4">4</a>. Example Exchanges ...............................................<a href="#page-4">4</a>
<a href="#section-5">5</a>. Formal Syntax ...................................................<a href="#page-6">6</a>
<a href="#section-6">6</a>. IANA Considerations .............................................<a href="#page-7">7</a>
<a href="#section-7">7</a>. Security Considerations .........................................<a href="#page-7">7</a>
<a href="#section-8">8</a>. Acknowledgements ................................................<a href="#page-7">7</a>
<a href="#section-9">9</a>. References ......................................................<a href="#page-8">8</a>
<a href="#section-9.1">9.1</a>. Normative References .......................................<a href="#page-8">8</a>
<a href="#section-9.2">9.2</a>. Informative References .....................................<a href="#page-8">8</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
Although [<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>] provides a URLFETCH command that can be used to
dereference a URL and return the body-part data, it does so by
returning the encoded form, without sufficient metadata to decode.
This is suitable for use in mail applications such as [<a href="#ref-BURL" title=""Message Submission BURL Extension"">BURL</a>], where
the encoded form is suitable, but not where access to the actual
content is required, such as in [<a href="#ref-STREAMING" title=""Streaming Internet Messaging Attachments"">STREAMING</a>].
This memo specifies a mechanism that returns additional metadata
about the part, such as its [<a href="#ref-MEDIATYPE" title=""Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types"">MEDIATYPE</a>] type, as well as removes any
content transfer encoding that was used on the body part.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Conventions Used in This Document</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in <a href="./rfc2119">RFC 2119</a> [<a href="#ref-KEYWORDS" title=""Key words for use in RFCs to Indicate Requirement Levels"">KEYWORDS</a>].
Protocol examples are line-wrapped for clarity. Protocol strings are
prefixed with C: and S: for client and server respectively, and
elided data is represented by [...]. Implementors should note these
notations are for editorial clarity only.
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Extended URLFETCH</span>
This extension is available in any IMAP server implementation that
includes URLAUTH=BINARY within its capability string.
Such servers accept additional, per-URL parameters to the URLFETCH
command and will provide, upon request, specific data for each URL
dereferenced.
<span class="grey">Cridland Standards Track [Page 2]</span>
<span id="page-3" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
<span class="h3"><a class="selflink" id="section-3.1" href="#section-3.1">3.1</a>. Command Parameters</span>
The URLFETCH command is extended by the provision of optional
parameters. The extended URLFETCH command is distinct by enclosing
each URL and associated parameters in a parenthesized list. Cases
where there is an absence of any parameters or where the URL is sent
unenclosed cause the command to behave precisely as specified in
[<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>].
Similarly, if the URL is invalid, the command will behave precisely
as specified in [<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>] and return a simple NIL.
Available parameters are:
BODYPARTSTRUCTURE
Provide a BODYPARTSTRUCTURE.
BODYPARTSTRUCTURE is defined in [<a href="#ref-CONVERT" title=""Internet Message Access Protocol - CONVERT Extension"">CONVERT</a>] and provides metadata
useful for processing applications, such as the type of data.
BINARY
Provide the data without any Content-Transfer-Encoding.
In particular, this means that the data MAY contain NUL octets and
not be formed from textual lines. Data containing NUL octets MUST
be transferred using the literal8 syntax defined in [<a href="#ref-BINARY" title=""IMAP4 Binary Content Extension"">BINARY</a>].
BODY
Provide the data as-is.
This will provide the same data as the unextended [<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>] as a
metadata item.
Metadata items MUST NOT appear more than once per URL requested, and
clients MUST NOT request both BINARY and BODY.
<span class="h3"><a class="selflink" id="section-3.2" href="#section-3.2">3.2</a>. Response Metadata</span>
In order to carry any requested metadata and provide additional
information to the consumer, the URLFETCH response is similarly
extended.
Following the URL itself, servers will include a series of
parenthesized metadata elements. Defined metadata elements are as
follows:
<span class="grey">Cridland Standards Track [Page 3]</span>
<span id="page-4" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
BODYPARTSTRUCTURE
The BODYPARTSTRUCTURE provides information about the data
contained in the response, as it has been returned. It will
reflect any conversions or decoding that have taken place. In
particular, this will show an identity encoding if BINARY is also
requested.
BINARY
The BINARY item provides the content, without any content transfer
encoding applied. If this is not possible (for example, the
content transfer encoding is unknown to the server), then this MAY
contain NIL. Servers MUST understand all identity content
transfer encodings defined in [<a href="#ref-MIME" title=""Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"">MIME</a>], as well as the
transformation encodings "Base64" [<a href="#ref-BASE64" title=""The Base16, Base32, and Base64 Data Encodings"">BASE64</a>] and "Quoted-Printable"
[<a href="#ref-MIME" title=""Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies"">MIME</a>].
BODY
The BODY item provides the content as found in the message, with
any content transfer encoding still applied. Requesting only the
BODY will provide equivalent functionality to the unextended
[<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>], however, using the extended syntax described herein.
Note that unlike [<a href="#ref-CONVERT" title=""Internet Message Access Protocol - CONVERT Extension"">CONVERT</a>], BODYPARTSTRUCTURE is not appended with
the part specifier, as this is implicit in the URL.
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Example Exchanges</span>
A client requests the data with no content transfer encoding.
C: A001 URLFETCH ("imap://[email protected]/INBOX/;uid=20/;
section=1.2;urlauth=anonymous:internal:
91354a473744909de610943775f92038" BINARY)
S: * URLFETCH "imap://[email protected]/INBOX/;uid=20/;
section=1.2;urlauth=anonymous:internal:
91354a473744909de610943775f92038" (BINARY {28}
S: Si vis pacem, para bellum.
S:
S: )
S: A001 OK URLFETCH completed
Note that the data here does not contain a NUL octet; therefore, a
literal -- not literal8 -- syntax has been used.
A client again requests data with no content transfer encoding, but
this time requests the body structure.
<span class="grey">Cridland Standards Track [Page 4]</span>
<span id="page-5" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
C: A001 URLFETCH ("imap://[email protected]/INBOX/;uid=20/;
section=1.3;urlauth=anonymous:internal:
ae354a473744909de610943775f92038" BINARY BODYPARTSTRUCTURE)
S: * URLFETCH "imap://[email protected]/INBOX/;uid=20/;
section=1.3;urlauth=anonymous:internal:
ae354a473744909de610943775f92038" (BODYPARTSTRUCTURE
("IMAGE" "PNG" () NIL NIL "BINARY" 123)) (BINARY ~{123}
S: [123 octets of data, some of which is NUL])
S: A001 OK URLFETCH completed
A client requests only the body structure.
C: A001 URLFETCH ("imap://[email protected]/INBOX/;uid=20/;
section=1.3;urlauth=anonymous:internal:
ae354a473744909de610943775f92038" BODYPARTSTRUCTURE)
S: * URLFETCH "imap://[email protected]/INBOX/;uid=20/;
section=1.3;urlauth=anonymous:internal:
ae354a473744909de610943775f92038" (BODYPARTSTRUCTURE
("IMAGE" "PNG" () NIL NIL "BASE64" 164))
S: A001 OK URLFETCH completed
A client requests the body structure and the original content.
C: A001 URLFETCH ("imap://[email protected]/INBOX/;uid=20/;
section=1.3;urlauth=anonymous:internal:
ae354a473744909de610943775f92038" BODYPARTSTRUCTURE BODY)
S: * URLFETCH "imap://[email protected]/INBOX/;uid=20/;
section=1.3;urlauth=anonymous:internal:
ae354a473744909de610943775f92038" (BODYPARTSTRUCTURE
("IMAGE" "PNG" () NIL NIL "BASE64" 164)) (BODY {164}
S: [164 octets of base64 encoded data])
S: A001 OK URLFETCH completed
Some parts cannot be decoded, so the server will provide the
BODYPARTSTRUCTURE of the part as is and provide NIL for the binary
content:
C: A001 URLFETCH ("imap://[email protected]/INBOX/;uid=20/;
section=1.4;urlauth=anonymous:internal:
87ecbd02095b815e699503fc20d869c8" BODYPARTSTRUCTURE BINARY)
S: * URLFETCH "imap://[email protected]/INBOX/;uid=20/;
section=1.4;urlauth=anonymous:internal:
87ecbd02095b815e699503fc20d869c8" (BODYPARTSTRUCTURE
("IMAGE" "PNG" () NIL NIL "X-BLURDYBLOOP" 123))
(BINARY NIL)
S: A001 OK URLFETCH completed
<span class="grey">Cridland Standards Track [Page 5]</span>
<span id="page-6" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
If a part simply doesn't exist, however, or the URI is invalid for
some other reason, then NIL is returned instead of metadata:
C: A001 URLFETCH ("imap://[email protected]/INBOX/;uid=20/;
section=200;urlauth=anonymous:internal:
88066d37e2e5410e1a6486350a8836ee" BODYPARTSTRUCTURE BODY)
S: * URLFETCH "imap://[email protected]/INBOX/;uid=20/;
section=200;urlauth=anonymous:internal:
88066d37e2e5410e1a6486350a8836ee" NIL
S: A001 OK URLFETCH completed
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Formal Syntax</span>
This formal syntax uses ABNF as specified in [<a href="#ref-ABNF" title=""Augmented BNF for Syntax Specifications: ABNF"">ABNF</a>], and includes
productions defined in [<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>], [<a href="#ref-BINARY" title=""IMAP4 Binary Content Extension"">BINARY</a>], and [<a href="#ref-IMAP" title=""INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1"">IMAP</a>].
capability =/ "URLAUTH=BINARY"
; Command parameters; see <a href="#section-3.1">Section 3.1</a>
urlfetch = "URLFETCH" 1*(SP url-fetch-arg)
url-fetch-arg = url-fetch-simple / url-fetch-ext
url-fetch-simple = url-full
; Unextended URLFETCH.
url-fetch-ext = "(" url-full *(SP url-fetch-param) ")"
; If no url-fetch-param present, as unextended.
url-fetch-param = "BODY" / "BINARY" / "BODYPARTSTRUCTURE" / atom
; Response; see <a href="#section-3.2">Section 3.2</a>
urlfetch-data = "*" SP "URLFETCH"
1*(SP (urldata-simple / urldata-ext /
urldata-error))
urldata-error = SP url-full SP nil
urldata-simple = SP url-full SP nstring
; If client issues url-fetch-simple, server MUST respond with
; urldata-simple.
urldata-ext = SP url-full url-metadata
url-metadata = 1*(SP "(" url-metadata-el ")")
<span class="grey">Cridland Standards Track [Page 6]</span>
<span id="page-7" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
url-metadata-el = url-meta-bodystruct / url-meta-body /
url-meta-binary
url-meta-bodystruct = "BODYPARTSTRUCTURE" SP body
url-meta-binary = "BINARY" SP ( nstring / literal8 )
; If content contains a NUL octet, literal8 MUST be used.
; Otherwise, content SHOULD use nstring.
; On decoding error, NIL should be used.
url-meta-body = "BODY" SP nstring
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. IANA Considerations</span>
IMAP4 capabilities are registered by publishing a Standards Track or
IESG-approved Experimental RFC.
This document defines the URLFETCH=BINARY IMAP capability. IANA has
added it to the registry accordingly.
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span>
Implementors are directed to the security considerations within
[<a href="#ref-IMAP" title=""INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1"">IMAP</a>], [<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>], and [<a href="#ref-BINARY" title=""IMAP4 Binary Content Extension"">BINARY</a>].
The ability of the holder of a URL to be able to fetch metadata about
the content pointed to by the URL as well as the content itself
allows a potential attacker to discover more about the content than
was previously possible, including its original filename and user-
supplied description.
The additional value of this information to an attacker is marginal,
and applies only to those URLs for which the attacker does not have
direct access, such as those produced by [<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>]. Implementors are
therefore directed to the security considerations present in
[<a href="#ref-URLAUTH" title=""Internet Message Access Protocol (IMAP) - URLAUTH Extension"">URLAUTH</a>].
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. Acknowledgements</span>
Comments were received on this idea and/or document from Neil Cook,
Philip Guenther, Alexey Melnikov, Ken Murchison, and others. Whether
in agreement or dissent, the comments have refined and otherwise
influenced this document.
<span class="grey">Cridland Standards Track [Page 7]</span>
<span id="page-8" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
<span class="h2"><a class="selflink" id="section-9" href="#section-9">9</a>. References</span>
<span class="h3"><a class="selflink" id="section-9.1" href="#section-9.1">9.1</a>. Normative References</span>
[<a id="ref-ABNF">ABNF</a>] Crocker, D. and P. Overell, "Augmented BNF for Syntax
Specifications: ABNF", STD 68, <a href="./rfc5234">RFC 5234</a>, January 2008.
[<a id="ref-BASE64">BASE64</a>] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", <a href="./rfc4648">RFC 4648</a>, October 2006.
[<a id="ref-BINARY">BINARY</a>] Nerenberg, L., "IMAP4 Binary Content Extension",
<a href="./rfc3516">RFC 3516</a>, April 2003.
[<a id="ref-CONVERT">CONVERT</a>] Melnikov, A. and P. Coates, "Internet Message Access
Protocol - CONVERT Extension", <a href="./rfc5259">RFC 5259</a>, July 2008.
[<a id="ref-IMAP">IMAP</a>] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
4rev1", <a href="./rfc3501">RFC 3501</a>, March 2003.
[<a id="ref-KEYWORDS">KEYWORDS</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>, March 1997.
[<a id="ref-MIME">MIME</a>] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part One: Format of Internet Message
Bodies", <a href="./rfc2045">RFC 2045</a>, November 1996.
[<a id="ref-URLAUTH">URLAUTH</a>] Crispin, M., "Internet Message Access Protocol (IMAP) -
URLAUTH Extension", <a href="./rfc4467">RFC 4467</a>, May 2006.
<span class="h3"><a class="selflink" id="section-9.2" href="#section-9.2">9.2</a>. Informative References</span>
[<a id="ref-BURL">BURL</a>] Newman, C., "Message Submission BURL Extension",
<a href="./rfc4468">RFC 4468</a>, May 2006.
[<a id="ref-MEDIATYPE">MEDIATYPE</a>] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types", <a href="./rfc2046">RFC 2046</a>,
November 1996.
[<a id="ref-STREAMING">STREAMING</a>] Cook, N., <a style="text-decoration: none" href='https://www.google.com/search?sitesearch=datatracker.ietf.org%2Fdoc%2Fhtml%2F&q=inurl:draft-+%22Streaming+Internet+Messaging+Attachments%22'>"Streaming Internet Messaging Attachments"</a>,
Work in Progress, March 2009.
<span class="grey">Cridland Standards Track [Page 8]</span>
<span id="page-9" ></span>
<span class="grey"><a href="./rfc5524">RFC 5524</a> URLFETCH Binary May 2009</span>
Author's Address
Dave Cridland
Isode Limited
5 Castle Business Village
36, Station Road
Hampton, Middlesex TW12 2BX
GB
EMail: [email protected]
Cridland Standards Track [Page 9]
Annotations
Select text to annotate