XEP-0221: Data Forms Media Element

Abstract
This specification defines an XMPP protocol extension for including media data in XEP-0004 data forms.
Authors
  • Ian Paterson
  • Peter Saint-Andre
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Draft

NOTICE: The protocol defined herein is a Draft Standard of the XMPP Standards Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.
Type
Standards Track
Version
1.0 (2008-09-03)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Introduction

In certain protocols that make use of Data Forms (XEP-0004) [1], it can be helpful to include media data such as small images. One example of such a "using protocol" is CAPTCHA Forms (XEP-0158) [2]. This document defines a method for including media data in a data form.

2. Media Element

The root element for media data is <media/>. This element MUST be qualified by the "urn:xmpp:media-element' namespace. The <media/> element MUST be contained within a <field/> element qualified by the 'jabber:x:data' namespace.

If the media is an image or video then the <media/> element SHOULD include 'height' and 'width' attributes specifying the recommended display size of the media in pixels.

The <media/> element SHOULD contain at least one <uri/> element to specify the out-of-band location of the media data. [3] If included, the <uri/> element MUST contain a URI that indicates the location and MUST include a 'type' attribute that specifies the MIME type of the media. If the URI scheme is cid: then the identifier MUST refer to a bit of binary data as described in Bits of Binary (XEP-0231) [4].

The 'type' attribute of the <uri/> element is REQUIRED. The value of the 'type' attribute MUST match the syntax specified in RFC 2045 [5]. That is, the value MUST include a top-level media type, the "/" character, and a subtype; in addition, it MAY include one or more optional parameters (e.g., the "audio/ogg" MIME type in the example shown below includes a "codecs" parameter as specified in RFC 4281 [6]). The "type/subtype" string SHOULD be registered in the IANA MIME Media Types Registry [7], but MAY be an unregistered or yet-to-be-registered value.

Example 1. Audio Media Element
<media xmlns='urn:xmpp:media-element'>
  <uri type='audio/x-wav'>
    http://victim.example.com/challenges/speech.wav?F3A6292C
  </uri>
  <uri type='audio/ogg; codecs=speex'>
    cid:sha1+a15a505e360702b79c75a5f67773072ed392f52a@bob.xmpp.org
  </uri>
  <uri type='audio/mpeg'>
    http://victim.example.com/challenges/speech.mp3?F3A6292C
  </uri>
</media>

The cid: URI points to data that can be retrieved using the protocol described in Bits of Binary (XEP-0231) [4] and the data element would be included along with the XMPP stanza containing the data form.

The following example is provided only for the purpose of illustration; consult the specifications for using protocols (e.g., XEP-0158) to see canonical examples.

Example 2. Inclusion in Data Form
<x xmlns='jabber:x:data' type='form'>
  [ ... ]
  <field var='ocr'>
    <media xmlns='urn:xmpp:media-element'
           height='80'
           width='290'>
      <uri type='image/jpeg'>
        http://www.victim.com/challenges/ocr.jpeg?F3A6292C
      </uri>
      <uri type='image/jpeg'>
        cid:sha1+f24030b8d91d233bac14777be5ab531ca3b9f102@bob.xmpp.org
      </uri>
    </media>
  </field>
  [ ... ]
</x>

3. Security Considerations

The ability to include arbitrary binary data implies that it is possible to send scripts, applets, images, and executable code, which may be potentially harmful. To reduce the risk of such exposure, an implementation MAY choose to not display or process such data but instead either completely ignore the data, show only the value of the 'alt' attribute (if included), or prompt a human user for approval (either explicitly via user action or implicitly via a list of approved entities from whom the user will accept binary data without per-event approval).

4. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [8].

5. XMPP Registrar Considerations

5.1 Protocol Namespaces

The XMPP Registrar [9] includes "urn:xmpp:media-element" in its registry of protocol namespaces (see <https://xmpp.org/registrar/namespaces.html>).

6. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:media-element'
    xmlns='urn:xmpp:media-element'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0221: http://www.xmpp.org/extensions/xep-0221.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='media'>
    <xs:complexType>
      <xs:sequence>
        <xs:element ref='uri' minOccurs='0' maxOccurs='unbounded'/>
      </xs:sequence>
      <xs:attribute name='height' type='xs:unsignedShort' use='optional'/>
      <xs:attribute name='width' type='xs:unsignedShort' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='uri'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='xs:anyURI'>
          <xs:attribute name='type' type='xs:string' use='required'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

</xs:schema>

Appendices

Appendix A: Document Information

Series
XEP
Number
0221
Publisher
XMPP Standards Foundation
Status
Draft
Type
Standards Track
Version
1.0
Last Updated
2008-09-03
Approving Body
XMPP Council
Dependencies
XMPP Core, XEP-0004
Supersedes
None
Superseded By
None
Short Name
media-element
Schema
<http://www.xmpp.org/schemas/media-element.xsd>
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Ian Paterson
Email
ian.paterson@clientside.co.uk
JabberID
ian@zoofy.com
Peter Saint-Andre
Email
xsf@stpeter.im
JabberID
peter@jabber.org
URI
http://stpeter.im/

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. XEP-0004: Data Forms <https://xmpp.org/extensions/xep-0004.html>.

2. XEP-0158: CAPTCHA Forms <https://xmpp.org/extensions/xep-0158.html>.

3. Constrained execution environments prevent some clients (e.g., Web clients) from rendering media unless it has been received out-of-band.

4. XEP-0231: Bits of Binary <https://xmpp.org/extensions/xep-0231.html>.

5. RFC 2045: Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies <http://tools.ietf.org/html/rfc2045>.

6. RFC 4281: The Codecs Parameter for "Bucket" Media Types <http://tools.ietf.org/html/rfc4281>.

7. IANA registry of MIME media types <http://www.iana.org/assignments/media-types>.

8. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

9. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

  1. Version 1.0 (2008-09-03)

    Per a vote of the XMPP Council, advanced status to Draft; concurrently, the XMPP Registrar issued the urn:xmpp:media-element namespace.

    psa
  2. Version 0.6 (2008-08-06)

    Further modified examples to track changes to XEP-0231.

    psa
  3. Version 0.5 (2008-08-06)

    Modified examples to track changes to XEP-0231.

    psa
  4. Version 0.4 (2008-07-27)

    Generalized text regarding inclusion of parameters in type attribute per RFC 2045.

    psa
  5. Version 0.3 (2008-06-18)

    Changed MUST to SHOULD regarding inclusion of uri element; allowed inclusion of codecs parameter in type attribute per RFC 4281; added Security Considerations section.

    psa
  6. Version 0.2 (2008-01-30)

    Modified to reuse data element from XEP-0231.

    psa
  7. Version 0.1 (2007-07-11)

    Initial version, split off from XEP-0158.

    psa/ip

END