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-0223.xml 12KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Persistent Storage of Private Data via PubSub</title>
  10. <abstract>This specification defines best practices for using the XMPP publish-subscribe extension to persistently store private information such as bookmarks and client configuration options.</abstract>
  12. <number>0223</number>
  13. <status>Active</status>
  14. <type>Informational</type>
  15. <sig>Standards JIG</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XMPP IM</spec>
  20. <spec>XEP-0030</spec>
  21. <spec>XEP-0060</spec>
  22. <spec>XEP-0115</spec>
  23. </dependencies>
  24. <supersedes/>
  25. <supersededby/>
  26. <shortname>N/A</shortname>
  27. &stpeter;
  28. <revision>
  29. <version>1.1</version>
  30. <date>2018-03-28</date>
  31. <initials>jwi</initials>
  32. <remark>Make discovery of support mandatory, add security considerations (in reaction to CVE-2018-6591).</remark>
  33. </revision>
  34. <revision>
  35. <version>1.0</version>
  36. <date>2008-09-08</date>
  37. <initials>psa</initials>
  38. <remark><p>Per a vote of the XMPP Council, advanced specification to Active.</p></remark>
  39. </revision>
  40. <revision>
  41. <version>0.3</version>
  42. <date>2008-06-20</date>
  43. <initials>psa</initials>
  44. <remark><p>Added text about composition model, and modified examples accordingly.</p></remark>
  45. </revision>
  46. <revision>
  47. <version>0.2</version>
  48. <date>2008-03-03</date>
  49. <initials>psa</initials>
  50. <remark><p>Removed hokey acronym; changed type to Informational; clarified text.</p></remark>
  51. </revision>
  52. <revision>
  53. <version>0.1</version>
  54. <date>2007-08-08</date>
  55. <initials>psa</initials>
  56. <remark><p>Initial published version.</p></remark>
  57. </revision>
  58. <revision>
  59. <version>0.0.1</version>
  60. <date>2007-07-18</date>
  61. <initials>psa</initials>
  62. <remark><p>First draft.</p></remark>
  63. </revision>
  64. </header>
  65. <section1 topic='Introduction' anchor='intro'>
  66. <section2 topic='Motivation' anchor='motivation'>
  67. <p>&xep0163; introduced the idea of a virtual &xep0060; service associated with an IM user's bare JID &LOCALBARE;. However, the default configuration of PEP nodes is not optimized for the persistent storage of data objects that are meant to be accessed only by the account owner, &#224; la &xep0049;. Therefore this document defines a set of best practices that enable IM users to persistently store private information at their virtual pubsub service; in effect, we "sub-class" PEP by showing how a particular pubsub node can be configured for storing private data.</p>
  68. </section2>
  69. <section2 topic='How It Works' anchor='howitworks'>
  70. <p>Imagine that you are a Shakespearean character named Juliet and that you want to persistently store some private information such as bookmarks (&xep0048;).</p>
  71. <p>We assume that your server (capulet.lit) supports PEP along with the "publish-options" feature, and that your client discovered that support when you logged in.</p>
  72. <p>You want to start bookmarking &xep0045; rooms, so your client stores that data privately.</p>
  73. <example caption='Storing bookmarks'><![CDATA[
  74. <iq from='juliet@capulet.lit/balcony' type='set' id='pdp1'>
  75. <pubsub xmlns=''>
  76. <publish node='storage:bookmarks'>
  77. <item>
  78. <conference xmlns='storage:bookmarks'
  79. autojoin='true'
  80. jid='theplay@conference.shakespeare.lit'
  81. name='The Play&apos;s the Thing'>
  82. <nick>JC</nick>
  83. <password>Gl0b3</password>
  84. </conference>
  85. </item>
  86. </publish>
  87. <publish-options>
  88. <x xmlns='jabber:x:data' type='submit'>
  89. <field var='FORM_TYPE' type='hidden'>
  90. <value></value>
  91. </field>
  92. <field var='pubsub#persist_items'>
  93. <value>true</value>
  94. </field>
  95. <field var='pubsub#access_model'>
  96. <value>whitelist</value>
  97. </field>
  98. </x>
  99. </publish-options>
  100. </pubsub>
  101. </iq>
  102. ]]></example>
  103. <p>Your publish request is a standard pubsub request except that:</p>
  104. <ol start='1'>
  105. <li>The item is persisted (pubsub#persist_items is set to true).</li>
  106. <li>In this case, access is limited to yourself (the "whitelist" access model defaults to allowing access for the account owner, i.e., you).</li>
  107. </ol>
  108. <p>If all goes well (see <link url='#publish'>Storing Data</link>), your bookmarks will be stored and the information will be pushed out to all of your resources (here "balcony" and "chamber").</p>
  109. <example caption='Publisher receives event notification'><![CDATA[
  110. <message from='juliet@capulet.lit'
  111. to='juliet@capulet.lit/balcony'
  112. type='headline'
  113. id='bmfoo1'>
  114. <event xmlns=''>
  115. <items node='storage:bookmarks'>
  116. <item id='SomeID'>
  117. <conference xmlns='storage:bookmarks'
  118. autojoin='true'
  119. jid='theplay@conference.shakespeare.lit'
  120. name='The Play&apos;s the Thing'>
  121. <nick>JC</nick>
  122. <password>Gl0b3</password>
  123. </conference>
  124. </item>
  125. </items>
  126. </event>
  127. </message>
  128. <message from='juliet@capulet.lit'
  129. to='juliet@capulet.lit/chamber'
  130. type='headline'
  131. id='bmfoo2'>
  132. <event xmlns=''>
  133. <items node='storage:bookmarks'>
  134. <item id='SomeID'>
  135. <conference xmlns='storage:bookmarks'
  136. autojoin='true'
  137. jid='theplay@conference.shakespeare.lit'
  138. name='The Play&apos;s the Thing'>
  139. <nick>JC</nick>
  140. <password>Gl0b3</password>
  141. </conference>
  142. </item>
  143. </items>
  144. </event>
  145. </message>
  146. ]]></example>
  147. <p>So that's the general idea.</p>
  148. </section2>
  149. </section1>
  150. <section1 topic='Concepts and Approach' anchor='approach'>
  151. <p>The best practices defined herein re-use the concepts already defined in <cite>XEP-0060</cite> and <cite>XEP-0163</cite>. In order to optimize for object persistence of private information instead of transient event notifications related to semi-public data, a node MUST be configured as follows:</p>
  152. <ol start='1'>
  153. <li>Set pubsub#persist_items to true.</li>
  154. <li>Set pubsub#access_model to "whitelist".</li>
  155. </ol>
  156. </section1>
  157. <section1 topic='Storing Data' anchor='store'>
  158. <p>An account owner publishes an item to a node by following the protocol specified in <cite>XEP-0060</cite>:</p>
  159. <example caption='Account owner stores data'><![CDATA[
  160. <iq from='juliet@capulet.lit/balcony' type='set' id='pdp1'>
  161. <pubsub xmlns=''>
  162. <publish node='storage:bookmarks'>
  163. <item>
  164. <conference xmlns='storage:bookmarks'
  165. autojoin='true'
  166. jid='theplay@conference.shakespeare.lit'
  167. name='The Play&apos;s the Thing'>
  168. <nick>JC</nick>
  169. <password>Gl0b3</password>
  170. </conference>
  171. </item>
  172. </publish>
  173. </pubsub>
  174. </iq>
  175. ]]></example>
  176. <p>If the node does not already exist, the virtual pubsub service MUST create the node. As described in <cite>XEP-0163</cite>, this "auto-create" feature (defined in <cite>XEP-0060</cite>) MUST be supported by a PEP service. (Naturally, the account owner's client MAY follow the node creation use case specified in <cite>XEP-0060</cite> before attempting to publish an item.)</p>
  177. <p>In order for the client to reliably persist private information, the virtual pubsub service must also support the "publish-options" feature defined in <cite>XEP-0060</cite>. Typically, a client will publish with options so that the object is privately stored.</p>
  178. <example caption='Storing bookmarks'><![CDATA[
  179. <iq from='juliet@capulet.lit/balcony' type='set' id='pdp1'>
  180. <pubsub xmlns=''>
  181. <publish node='storage:bookmarks'>
  182. <item>
  183. <conference xmlns='storage:bookmarks'
  184. autojoin='true'
  185. jid='theplay@conference.shakespeare.lit'
  186. name='The Play&apos;s the Thing'>
  187. <nick>JC</nick>
  188. <password>Gl0b3</password>
  189. </conference>
  190. </item>
  191. </publish>
  192. <publish-options>
  193. <x xmlns='jabber:x:data' type='submit'>
  194. <field var='FORM_TYPE' type='hidden'>
  195. <value></value>
  196. </field>
  197. <field var='pubsub#persist_items'>
  198. <value>true</value>
  199. </field>
  200. <field var='pubsub#access_model'>
  201. <value>whitelist</value>
  202. </field>
  203. </x>
  204. </publish-options>
  205. </pubsub>
  206. </iq>
  207. ]]></example>
  208. <p>If the publication logic dictates that event notifications shall be sent, the account owner's server generates notifications and sends them to all appropriate entities as described in the Receiving Event Notifications section of <cite>XEP-0163</cite>.</p>
  209. </section1>
  210. <section1 topic='Composition' anchor='composition'>
  211. <p>Each item published to the node is a logically separate instance of the data to be stored. It is the responsibility of the publishing and receiving entities to construct a complete view of all such items, if desired. For example, each bookmark published to a private data node is a separate piece of data, whereas the history of all items published to the node provides a complete list of the user's bookmarks. This history may include items that are republished with an existing ItemID (thus overwriting the previous version of that item).</p>
  212. </section1>
  213. <section1 topic='Determining Support' anchor='support'>
  214. <p>Before an account owner attempts to complete any of the use cases defined herein, its client MUST verify that the account owner's server supports both PEP and the "publish-options" feature; to do so, it MUST send a &xep0030; information request to the server (or cache <cite>Entity Capabilities</cite> information received from the server).</p>
  215. <example caption='Account owner queries server regarding protocol support'><![CDATA[
  216. <iq from='juliet@capulet.lit/balcony'
  217. to='capulet.lit'
  218. id='disco1'
  219. type='get'>
  220. <query xmlns=''/>
  221. </iq>
  222. ]]></example>
  223. <p>The server MUST return an identity of "pubsub/pep" and include the "publish-options" feauture in the list of the namespaces and other features it supports:</p>
  224. <example caption='Server communicates protocol support'><![CDATA[
  225. <iq from='capulet.lit'
  226. to='juliet@capulet.lit/balcony'
  227. id='disco1'
  228. type='result'>
  229. <query xmlns=''>
  230. <identity category='server' type='im'/>
  231. <identity category='pubsub' type='pep'/>
  232. ...
  233. <feature var=''/>
  234. ...
  235. </query>
  236. </iq>
  237. ]]></example>
  238. </section1>
  239. <section1 topic='Security Considerations' anchor='security'>
  240. <p>Since private data is to be stored in a mechanism originally intended to <em>publish</em> data, it is REQUIRED for entities to ensure that the restrictive &lt;publish-options/&gt; will actually be honored by the server by performing the feature discovery procedure as specified in <link url='#support'>Determining Support</link>. If an entity using that procedure finds that the server does not support &lt;publish-options/&gt;, it MUST NOT store private data in PubSub, unless it can ensure privacy of the data with other means.</p>
  241. <p>The Security Considerations specified in <cite>XEP-0060</cite> and <cite>XEP-0163</cite> need to be taken into account.</p>
  242. </section1>
  243. <section1 topic='IANA Considerations' anchor='iana'>
  244. <p>This document requires no interaction with &IANA;.</p>
  245. </section1>
  246. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  247. <p>This document requires no interaction with the &REGISTRAR;.</p>
  248. </section1>
  249. </xep>