No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0359.xml 9.9KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY stanza-id "&lt;stanza-id/&gt;">
  4. <!ENTITY origin-id "&lt;origin-id/&gt;">
  5. <!ENTITY % ents SYSTEM 'xep.ent'>
  6. %ents;
  7. ]>
  8. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  9. <xep>
  10. <header>
  11. <title>Unique and Stable Stanza IDs</title>
  12. <abstract>This specification describes unique and stable IDs for messages.</abstract>
  14. <number>0359</number>
  15. <status>Experimental</status>
  16. <type>Standards Track</type>
  17. <sig>Standards</sig>
  18. <approver>Council</approver>
  19. <dependencies>
  20. <spec>XMPP Core</spec>
  21. </dependencies>
  22. <supersedes/>
  23. <supersededby/>
  24. <shortname>stanza-id</shortname>
  25. &flow;
  26. <revision>
  27. <version>0.5.0</version>
  28. <date>2017-08-23</date>
  29. <initials>dg</initials>
  30. <remark>
  31. <ul>
  32. <li>Business rules clarifications</li>
  33. <li>Define stanza-ids for messages only</li>
  34. </ul>
  35. </remark>
  36. </revision>
  37. <revision>
  38. <version>0.4.1</version>
  39. <date>2017-05-20</date>
  40. <initials>egp</initials>
  41. <remark><ul>
  42. <li>Added an XML schema.</li>
  43. <li>Fixed a typo.</li>
  44. </ul></remark>
  45. </revision>
  46. <revision>
  47. <version>0.4</version>
  48. <date>2016-10-30</date>
  49. <initials>dg</initials>
  50. <remark>
  51. <p>Add ability to discover support</p>
  52. </remark>
  53. </revision>
  54. <revision>
  55. <version>0.3.0</version>
  56. <date>2016-10-29</date>
  57. <initials>fs</initials>
  58. <remark>
  59. <p>Rename client-id element to origin-id.</p>
  60. <p>Minor improvements.</p>
  61. </remark>
  62. </revision>
  63. <revision>
  64. <version>0.2.1</version>
  65. <date>2015-09-22</date>
  66. <initials>fs</initials>
  67. <remark>
  68. <p>Minor fixes (typos, s/JID/XMPP Address, etc.)</p>
  69. </remark>
  70. </revision>
  71. <revision>
  72. <version>0.2</version>
  73. <date>2015-09-18</date>
  74. <initials>fs</initials>
  75. <remark>
  76. <ul>
  77. <li>Refactored client-id from attribute to element.</li>
  78. <li>Set short name to 'stanza-id'.</li>
  79. <li>Clarified that SID elements must not have additional content.</li>
  80. </ul>
  81. </remark>
  82. </revision>
  83. <revision>
  84. <version>0.1</version>
  85. <date>2015-07-14</date>
  86. <initials>XEP Editor (mam)</initials>
  87. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  88. </revision>
  89. <revision>
  90. <version>0.0.2</version>
  91. <date>2015-06-22</date>
  92. <initials>fs</initials>
  93. <remark>
  94. <ul>
  95. <li>Rename the XEP from "Message IDs" to "Stanza IDs"</li>
  96. <li>Add 'by' attribute</li>
  97. </ul>
  98. </remark>
  99. </revision>
  100. <revision>
  101. <version>0.0.1</version>
  102. <date>2015-06-01</date>
  103. <initials>fs</initials>
  104. <remark><p>First draft.</p></remark>
  105. </revision>
  106. </header>
  107. <section1 topic='Introduction' anchor='intro'>
  108. <p>This XEP introduces unique and stable IDs for messages, which are beneficial in various ways. For example, they can be used together with &xep0313; to uniquely identify a message within an archive. They are also useful in the context of &xep0045; conferences, as they allow to identify a message reflected by a MUC service back to the originating entity.</p>
  109. </section1>
  110. <section1 topic='Use Cases' anchor='usecases'>
  111. <section2 topic='Unique stanza IDs' anchor='stanza-id'>
  112. <example caption='The stanza ID extension.'><![CDATA[
  113. <stanza-id xmlns='urn:xmpp:sid:0'
  114. id='de305d54-75b4-431b-adb2-eb6b9e546013'
  115. by=''/>
  116. ]]></example>
  117. <p>In order to create a &stanza-id; extension element, the creating XMPP entity generates and sets the value of the 'id' attribute, and puts its own XMPP address as value of the 'by' attribute. The value of the 'id' attribute must be unique and stable, i.e. it MUST NOT change later for some reason within the scope of the 'by' value. Thus the IDs defined in this extension MUST be unique and stable within the scope of the generating XMPP entity. It is RECOMMENDED that the ID generating service uses UUID and the algorithm defined in &rfc4122; to generate the IDs.</p>
  118. </section2>
  119. <section2 topic='Origin generated stanza IDs' anchor='origin-id'>
  120. <p>
  121. Some use cases require the originating entity, e.g. a client, to generate the stanza ID. In this case, the client MUST use the &origin-id; element extension element qualified by the 'urn:xmpp:sid:0' namespace. Note that originating entities often want to conceal their XMPP address and therefore the &origin-id; element has no 'by' attribute.
  122. </p>
  123. <example caption='A message stanza with the stanza ID extension.'><![CDATA[
  124. <message xmlns='jabber:client'
  125. to=''
  126. type='groupchat'>
  127. <body>Typical body text</body>
  128. <origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013'/>
  129. </message>]]></example>
  130. <p>
  131. The server or component MAY add a &stanza-id; element. In that case, it MUST preserve the content of the &origin-id; element.
  132. </p>
  133. <example caption='A message stanza with the stanza ID extension.'><![CDATA[
  134. <message xmlns='jabber:client'
  135. to=''
  136. type='groupchat'>
  137. <body>Typical body text</body>
  138. <stanza-id xmlns='urn:xmpp:sid:0'
  139. id='5f3dbc5e-e1d3-4077-a492-693f3769c7ad'
  140. by=''/>
  141. <origin-id xmlns='urn:xmpp:sid:0' id='de305d54-75b4-431b-adb2-eb6b9e546013'/>
  142. </message>]]></example>
  143. </section2>
  144. </section1>
  145. <section1 topic='Business Rules' anchor='rules'>
  146. <ol>
  147. <li>The values of the 'id' attribute SHOULD be unpredictable.</li>
  148. <li>Stanza ID generating entities, which encounter a &stanza-id; element where the 'by' attribute matches the 'by' attribute they would otherwise set, MUST delete that element even if they are not adding their own stanza ID.</li>
  149. <li>Entities, which are routing stanzas, SHOULD NOT strip any elements qualified by the 'urn:xmpp:sid:0' namespace from message stanzas unless the preceding rule applied to those elements.</li>
  150. <li>Stanzas MUST possess, in the direct child level of the stanza, at most one &stanza-id; extension element with the same XMPP address as value of the 'by' attribute.</li>
  151. <li>Every &stanza-id; extension element MUST have the 'id' attribute and the 'by' attribute set.</li>
  152. <li>Every &stanza-id; and &origin-id; extension element MUST always possess an 'id' attribute and MUST NOT have any child elements or text content.</li>
  153. <li>The value of the 'by' attribute MUST be the XMPP address of the entity assigning the unique and stable stanza ID. For one-on-one messages the assigning entity is the account. In groupchats the assigning entity is the room. Note that XMPP addresses are normalized as defined in &rfc6122;.</li>
  154. </ol>
  155. </section1>
  156. <section1 topic='Discovering Support' anchor='disco'>
  157. <p>An entity that follows the business rules, especially the rule on overriding the ID in elements where the by atttribute matches the 'by' attribute they would otherwise set, SHOULD announce the 'urn:xmpp:sid:0' namespace in its disco features allowing other entities to verify that those business rules are properly enforced.</p>
  158. <example caption='Client sends service discovery request to the room'><![CDATA[
  159. <iq from='romeo@montague.tld/garden'
  160. id='somethingrandom'
  161. to=''
  162. type='get'>
  163. <query xmlns='' />
  164. </iq>
  165. ]]></example>
  166. <example caption='Servers includes the stanza ID namespace in its features'><![CDATA[
  167. <iq from=''
  168. to='romeo@montague.tld/garden'
  169. id='somethingrandom'
  170. type='result'>
  171. <query xmlns=''>
  172. <feature var='urn:xmpp:sid:0'/>
  173. </query>
  174. </iq>
  175. ]]></example>
  176. </section1>
  177. <section1 topic='Security Considerations' anchor='security'>
  178. <p>The value of the 'id' attribute should not provide any further information besides the opaque ID itself. Entities observing the value MUST NOT be able to infer any information from it, e.g. the size of the message archive. The value of 'id' MUST be considered a non-secret value.</p>
  179. <p>Before processing the stanza ID of a message and using it for deduplication purposes or for MAM catchup, the receiving entity SHOULD ensure that the stanza ID could not have been faked, by verifying that the entity referenced in the by attribute does annouce the 'urn:xmpp:sid:0' namespace in its disco features.</p>
  180. </section1>
  181. <section1 topic='IANA Considerations' anchor='iana'>
  182. <p>This document requires no interaction with &IANA;.</p>
  183. </section1>
  184. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  185. <section2 topic='Protocol Namespaces' anchor='ns'>
  186. <p>This specification defines the following XML namespaces:</p>
  187. <ul>
  188. <li>urn:xmpp:sid:0</li>
  189. </ul>
  190. <p>The &REGISTRAR; shall include the foregoing namespaces in its registry of protocol namespaces (see &NAMESPACES;) and in its disco features registry (&DISCOFEATURES;) as defined in &xep0030;.</p>
  191. <code caption='Registration'><![CDATA[
  192. <var>
  193. <name>urn:xmpp:sid:0</name>
  194. <desc>Indicates that an entity adds stanza-ids and follows the business rules described in the XEP</desc>
  195. <doc>XEP-0359</doc>
  196. </var>
  197. ]]></code>
  198. </section2>
  199. </section1>
  200. <section1 topic='XML Schema' anchor='schema'>
  201. <code><![CDATA[
  202. <?xml version='1.0' encoding='UTF-8'?>
  203. <xs:schema
  204. xmlns:xs=''
  205. targetNamespace='urn:xmpp:sid:0'
  206. elementFormDefault='qualified'>
  207. <xs:annotation>
  208. <xs:documentation>
  209. The protocol documented by this schema is defined in
  210. XEP-0359:
  211. </xs:documentation>
  212. </xs:annotation>
  213. <xs:element name='stanza-id'>
  214. <xs:complexType>
  215. <xs:attribute name='id' type='xs:string' use='required'/>
  216. <xs:attribute name='by' type='xs:string' use='required'/>
  217. </xs:complexType>
  218. </xs:element>
  219. <xs:element name='origin-id'>
  220. <xs:complexType>
  221. <xs:attribute name='id' type='xs:string' use='required'/>
  222. </xs:complexType>
  223. </xs:element>
  224. </xs:schema>]]></code>
  225. </section1>
  226. <section1 topic='Acknowledgements' anchor='ack'>
  227. <p>Thanks to Thijs Alkemade and Georg Lukas for providing feedback.</p>
  228. </section1>
  229. </xep>