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-0356.xml 24KB

  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>Privileged Entity</title>
  10. <abstract>This specification provides a way for XMPP entities to have a privileged access to some other entities data</abstract>
  12. <number>0356</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>NOT_YET_ASSIGNED</shortname>
  23. <author>
  24. <firstname>Jérôme</firstname>
  25. <surname>Poisson</surname>
  26. <email></email>
  27. <jid></jid>
  28. </author>
  29. <revision>
  30. <version>0.3</version>
  31. <date>2017-09-11</date>
  32. <initials>XEP Editor (jwi)</initials>
  33. <remark>Defer due to lack of activity.</remark>
  34. </revision>
  35. <revision>
  36. <version>0.2</version>
  37. <date>2015-03-23</date>
  38. <initials>jp</initials>
  39. <remark>
  40. <p>Several updates according to feedbacks + review:</p>
  41. <ul>
  42. <li>added links to PEP and namespace delegation XEPs</li>
  43. <li>removed MUST for default values in configuration</li>
  44. <li>&lt;forwarded/&gt; element is now a child of a &lt;privilege/&gt; element</li>
  45. <li>&lt;perm/&gt; "namespace" attribute has been renamed to "access"</li>
  46. <li>"headline" type restriction for "message" privilege has been removed</li>
  47. <li>"message" permission violation now result in a "forbidden" message error</li>
  48. <li>for "presence" permission, only &PRESENCE; stanza with no type or with a "unavailable" type are sent to privileged entity</li>
  49. <li>added specifitation for "presence" if a managed entity is unavailable and if a privileged entity is available after first &PRESENCE; stanzas have been received</li>
  50. <li>added Business Rules section</li>
  51. <li>Updated namespace to reflect incompatible changes</li>
  52. </ul>
  53. </remark>
  54. </revision>
  55. <revision>
  56. <version>0.1</version>
  57. <date>2015-01-27</date>
  58. <initials>XEP Editor (mam)</initials>
  59. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  60. </revision>
  61. <revision>
  62. <version>0.0.4</version>
  63. <date>2014-12-18</date>
  64. <initials>jp</initials>
  65. <remark><ul>
  66. <li>Big simplification and restriction following council's veto and standard@ discussions</li>
  67. <li>Configuration is now done only on server own configuration</li>
  68. <li>No more client mode</li>
  69. <li>Permissions are adverised using &MESSAGE;</li>
  70. <li>The only &IQ; privilege still available is jabber:iq:roster</li>
  71. </ul>
  72. </remark>
  73. </revision>
  74. <revision>
  75. <version>0.0.3</version>
  76. <date>2014-11-13</date>
  77. <initials>jp</initials>
  78. <remark><ul>
  79. <li>giving permission to manage this XEP namespace is forbidden</li>
  80. <li>Added configuration section; with well-defined command node</li>
  81. <li>better specification of persistent permissions</li>
  82. <li>fixed erroneous example (server returns bookmarks)</li>
  83. <li>added special permissions</li>
  84. <li>better specification of &QUERY; element</li>
  85. </ul>
  86. </remark>
  87. </revision>
  88. <revision>
  89. <version>0.0.2</version>
  90. <date>2014-09-17</date>
  91. <initials>jp</initials>
  92. <remark><ul>
  93. <li>changed for privileged entity</li>
  94. <li>fixes after feedbacks on standard mailing list</li>
  95. <li>completed missing required parts</li>
  96. </ul>
  97. </remark>
  98. </revision>
  99. <revision>
  100. <version>0.0.1</version>
  101. <date>2014-05-09</date>
  102. <initials>jp</initials>
  103. <remark><p>First draft.</p></remark>
  104. </revision>
  105. </header>
  106. <section1 topic='Introduction' anchor='intro'>
  107. <p>XMPP components are used for long through &xep0114;, but are quite limited: they have a restricted access to other entities data, similar to what a client can do. This is sufficient for components like gateways, but very limiting for more complex components like a PubSub service. The goal of this XEP is to allow a component or any entity to have a "privileged" status, and access some other entity data with the same privileges than the entity itself, that means manage an entity roster on its behalf, send &MESSAGE; or receive &PRESENCE; stanzas in the name of the server.</p>
  108. <p>Privileged entities have numerous advantages, including:</p>
  109. <ul>
  110. <li>a step forward in decentralization: it is possible for an entity to do tasks which were before reserved to server itself. For example, a privileged pubsub component can offer access model based on publisher's roster</li>
  111. <li>better integration of components: a gateway can add items to an entity roster itself</li>
  112. <li>possibility to overpass a server limitation (typically: incomplete &xep0163; implementation)</li>
  113. <li>quick development cycle: developers can implement the components they need without waiting for a new server release</li>
  114. <li>server agnostic</li>
  115. </ul>
  116. <p>Privileged entity has been created with the main goal to create an external, server agnostic, PEP service. It is restricted to only a couple of features, see <link url='#acks'>Acknowledgements section</link> for more details.</p>
  117. <p>This XEP is complementary to &xep0355; (and works in a similar way), although they can be used together or separately. To build something like an external PEP service, it is necessary to use both XEPs.</p>
  118. </section1>
  119. <section1 topic='Requirements' anchor='reqs'>
  120. <p>A privileged entity must be able to do what a PEP service can do and to access roster, so it must be able to (according to configuration):</p>
  121. <ul>
  122. <li>get and modify the roster of any entity managed by the server</li>
  123. <li>send a &MESSAGE; stanza on behalf of the server</li>
  124. <li>access &PRESENCE; informations for entities in a managed entity's roster (and for managed entity itself)</li>
  125. </ul>
  126. <p>The privilege mechanism MUST be totally transparent for the managed entities.</p>
  127. </section1>
  128. <section1 topic='Glossary' anchor='glossary'>
  129. <ul>
  130. <li><strong>Privileged entity</strong> — the entity which has a privileged status.</li>
  131. <li><strong>Managed entity</strong> — the entity that is managed by a privileged entity.</li>
  132. </ul>
  133. </section1>
  134. <section1 topic='Accessing Roster' anchor='access_roster'>
  135. <section2 topic='Server Allows Roster Access' anchor='server_roster'>
  136. <p>Roster access is granted in the server configuration. Roster access can have 4 types:</p>
  137. <ul>
  138. <li><strong>none</strong> — the entity is not allowed to access managed entity roster at all. This is usually the default value.</li>
  139. <li><strong>get</strong> — the entity is allowed to send &IQ; stanzas of type <em>'get'</em> for the namespace 'jabber:iq:roster'.</li>
  140. <li><strong>set</strong> — the entity is allowed to send &IQ; stanzas of type <em>'set'</em> for namespace 'jabber:iq:roster'.</li>
  141. <li><strong>both</strong> — the entity is allowed to send &IQ; stanzas of type <em>'get'</em> and <em>'set'</em> for namespace 'jabber:iq:roster'.</li>
  142. </ul>
  143. </section2>
  144. <section2 topic='Server Advertises Entity Of Allowed Permission' anchor='advertise_roster'>
  145. <p>Once a privileged entity is authenticated and stream is started, the server send it a &MESSAGE; stanza with a &lt;privilege/&gt; elements which MUST have the namespace 'urn:xmpp:privilege:1'. This element contains &lt;perm/&gt; elements which MUST contain a 'access' attribute of the value "roster" and a 'type' attribute which must correspond to the type configured as specified in <link url='#server_roster'>"Server Allows Roster Access" section</link></p>
  146. <example caption='Server Advertises Roster Privilege'><![CDATA[
  147. <message from='' to='pubub.capulet.lit' id='12345'>
  148. <privilege xmlns='urn:xmpp:privilege:1'>
  149. <perm access='roster' type='both'/>
  150. </privilege>
  151. </message>
  152. ]]></example>
  153. <p>Here <em>pubsub.capulet.lit</em> is allowed to do <em>get</em> and <em>set</em> operations on all entities managed by capulet.lit</p>
  154. </section2>
  155. <section2 topic='Privileged Entity Manage Roster' anchor='priv_manage_roster'>
  156. <p>Doing a <em>get</em> or <em>set</em> operation on the roster of a managed entity is done in the usual way (as described in &rfc6121; section 2), except that the 'to' attribute is set to the attribute of the managed entity. The server MUST check that the privileged entity has right to <em>get</em> or <em>set</em> the roster of managed entity, and MUST return a &forbidden; error if it is not the case:</p>
  157. <example caption='Privileged Entity Get Managed Entity Roster'><![CDATA[
  158. <iq id='roster1'
  159. from='pubsub.capulet.lit'
  160. to=''
  161. type='get'
  162. id='roster1'>
  163. <query xmlns='jabber:iq:roster'/>
  164. </iq>
  165. ]]></example>
  166. <p>The server then answers normally, as it would have done to the managed entity:</p>
  167. <example caption='Server Answers To Privileged Entity'><![CDATA[
  168. <iq id='roster1'
  169. from=''
  170. to=''
  171. type='result'>
  172. <query xmlns='jabber:iq:roster' ver='ver7'>
  173. <item jid=''/>
  174. <item jid=''/>
  175. </query>
  176. </iq>
  177. ]]></example>
  178. </section2>
  179. </section1>
  180. <section1 topic='Message Permission' anchor='message'>
  181. <section2 topic='Authorizing Messages' anchor='auth_mess'>
  182. <p>In some cases, it can be desirable to send notifications (e.g. PEP service), so the privileged entity must be able to send &MESSAGE; stanzas. This is allowed in server configuration in the same way as for roster permission. The permission type can have the following values:</p>
  183. <ul>
  184. <li><strong>none</strong> — the entity is not allowed to send &MESSAGE; stanza in the name of the server. This is usually the default value.</li>
  185. <li><strong>outgoing</strong> — the entity is allowed to send &MESSAGE; stanzas in the name of the server, according to following restrictions.</li>
  186. </ul>
  187. <p>A privileged entity can then send message on the behalf either of the server or of a bare JID of an entity managed by the server (i.e. a bare jid with the same domain as the server), using &xep0297;. The &lt;forwarded/&gt; element MUST be a child of a &lt;privilege/&gt; element with a namespace of <em>'urn:xmpp:privilege:1'</em>, with the following restriction:</p>
  188. <ol>
  189. <li>forwarded &MESSAGE; 'from' attribute MUST be a bare JID from the server, no resource is allowed</li>
  190. </ol>
  191. <p>If this rule is violated, the server MUST return a &MESSAGE; error with condition &lt;forbidden/&gt;, as in &rfc6120; section</p>
  192. </section2>
  193. <section2 topic='Advertising Permission' anchor='advertise_mess'>
  194. <p>Server advertises "message" permission in the same way as for "roster" permission, except that 'access' attribute has the value of "message", and the 'type' attribute as a value of 'outgoing':</p>
  195. <example caption='Server Advertises Roster And Message Privileges'><![CDATA[
  196. <message from='' to='pubub.capulet.lit' id='54321'>
  197. <privilege xmlns='urn:xmpp:privilege:1'>
  198. <perm access='roster' type='both'/>
  199. <perm access='message' type='outgoing'/>
  200. </privilege>
  201. </message>
  202. ]]></example>
  203. </section2>
  204. <section2 topic='Sending Messages' anchor='sending_mess'>
  205. <p>Now that <em>pubsub.capulet.lit</em> is allowed, it can send messages using &lt;forwarded/&gt; elements.</p>
  206. <example caption='privileged entity send a notificaction message'><![CDATA[
  207. <message from='pubsub.capulet.lit' to='capulet.lit' id='notif1'>
  208. <privilege xmlns='urn:xmpp:privilege:1'>
  209. <forwarded xmlns='urn:xmpp:forward:0'>
  210. <message from='juliet@capulet.lit'
  211. id='foo'
  212. to='romeo@montague.lit/orchard'
  213. xmlns='jabber:client'>
  214. <event xmlns=''>
  215. <items node=''>
  216. <item>
  217. <tune xmlns=''>
  218. <artist>Gerald Finzi</artist>
  219. <length>255</length>
  220. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  221. <title>Introduction (Allegro vigoroso)</title>
  222. <track>1</track>
  223. </tune>
  224. </item>
  225. </items>
  226. </event>
  227. <delay xmlns='urn:xmpp:delay' stamp='2014-11-25T14:34:32Z'/>
  228. </message>
  229. </forwarded>
  230. </privilege>
  231. </message>
  232. ]]></example>
  233. <p>The server sees that forwarded message 'from' attribute (<em>juliet@capulet.lit</em>) is a bare JID of the server, and that outgoing message permission was granted; it can now send the notification:</p>
  234. <example caption='server sends the notification as if it was originating from him'><![CDATA[
  235. <message from='juliet@capulet.lit'
  236. id='bar'
  237. to='romeo@montague.lit/orchard'>
  238. <event xmlns=''>
  239. <items node=''>
  240. <item>
  241. <tune xmlns=''>
  242. <artist>Gerald Finzi</artist>
  243. <length>255</length>
  244. <source>Music for "Love's Labors Lost" (Suite for small orchestra)</source>
  245. <title>Introduction (Allegro vigoroso)</title>
  246. <track>1</track>
  247. </tune>
  248. </item>
  249. </items>
  250. </event>
  251. <delay xmlns='urn:xmpp:delay' stamp='2014-11-25T14:34:32Z'/>
  252. </message>
  253. ]]></example>
  254. </section2>
  255. </section1>
  256. <section1 topic='Presence Permission' anchor='presence'>
  257. <section2 topic='Managed Entity Presence' anchor='managed_ent_presence'>
  258. <p>It can be often desirable for a privileged entity to have presence information of the managed entities (e.g. to know when to send them notificiations). As privileges must be transparent for the managed entity, this presence has to be sent by the server without modifying managed entity roster.</p>
  259. <p>This is allowed in server configuration in the same way as for <em>roster</em> and <em>message</em> permissions. The "presence" type can have the following values:</p>
  260. <ul>
  261. <li><strong>none</strong> — the entity is not allowed to access &PRESENCE; informations at all. This is usually the default value.</li>
  262. <li><strong>managed_entity</strong> — the entity is allowed to receive managed entity presence (see below).</li>
  263. <li><strong>roster</strong> — the entity is allowed to receive presence informations of managed entity contacts, see <link url='#roster_presence'>Roster Presence section</link>.</li>
  264. </ul>
  265. <p>If the privilege is granted, the server MUST use a directed presence from the full jid of the managed entity, to the privileged entity, as specified in &rfc6121; section 4.6, on the behalf of managed entity each time its presence information change.</p>
  266. <p>Only presences with no 'type' attribute or with a 'type' attribute with the value "unavailable" are transmitted to the privileged entity, the server MUST NOT transmit &PRESENCE; stanza of any other type.</p>
  267. </section2>
  268. <section2 topic='Advertising Permission' anchor='advertise_managed_presence'>
  269. <p>Server advertises "presence" permission in the same way as for "roster" or "message" permissions, except that 'access' attribute has the value of "presence", and the 'type' attribute has a value of "managed_entity"</p>
  270. </section2>
  271. <section2 topic="Server Send presence informations" anchor='server_send_presence'>
  272. <p>Once the "presence" permission is granted, the server send presence informations:</p>
  273. <example caption='server receives new presence from Juliet'><![CDATA[
  274. <presence from='juliet@capulet.lit/balcony'
  275. id='presence1'
  276. xml:lang='en'>
  277. <show>chat</show>
  278. <status>Staying on the balcony</status>
  279. </presence>
  280. ]]></example>
  281. <example caption='server redirects presence to privileged entity'><![CDATA[
  282. <presence from='juliet@capulet.lit/balcony'
  283. to='pubsub.capulet.lit'
  284. id='presence1'
  285. xml:lang='en'>
  286. <show>chat</show>
  287. <status>Staying on the balcony</status>
  288. </presence>
  289. ]]></example>
  290. </section2>
  291. <section2 topic='Roster Presence' anchor='roster_presence'>
  292. <p>In addition to "<link url='#managed_ent_presence'>managed entity presence</link>", a privileged entity may need to know when a contact in managed entity roster is online (for example, it's necessary for a PEP service because of the presence default access model).</p>
  293. <p>As for other permissions, the access is granted in server's configuration, but there is an additional restriction: the privileged entity MUST have read permission on roster namespace (i.e. 'type' attribute in allowed &lt;perm&gt; of access <em>roster</em> MUST have a value of either <strong>get</strong> or <strong>both</strong>).</p>
  294. <p>If the privilege is granted, the server MUST send to the privileged entity every presence information with no 'type' attribute or with a 'type' with a value of 'unavailable' that the privileged entity is receiving or would receive if it were available. It do it in the same way as for <link url='#managed_ent_presence'>managing entity</link> by using directed &PRESENCE; from the full jid of the entity from which presence information has changed, to the privileged entity. If the managed entity is unavailable but the privileged entity is available, the server MUST send &PRESENCE; stanza to the later anyway.</p>
  295. <p>Having "roster" type for "presence" permission imply that you have also implicitly "managed_entity" type.</p><p>The server MUST reject the permission if the privileged entity doesn't have read permission on roster namespace.</p>
  296. <p>Note: this permission should be given carefully, as it gives access to presence of potentially a lot of entities to the privileged entity (see <link url='#security'>security considerations</link>).</p>
  297. </section2>
  298. <section2 topic='Advertising Permission' anchor='advertise_roster_presence'>
  299. <p>Server advertises roster "presence" permission in the same way as for other permissions, except that the 'access' attribute has the value of "presence", and the 'type' attribute has a value of "roster"</p>
  300. <example caption='Server Advertises Roster, Message, Managed Entity Presence and Roster Presence Privileges'><![CDATA[
  301. <message from='' to='pubub.capulet.lit' id='54321'>
  302. <privilege xmlns='urn:xmpp:privilege:1'>
  303. <perm access='roster' type='both'/>
  304. <perm access='message'/>
  305. <perm access='presence' type='roster'/>
  306. </privilege>
  307. </message>
  308. ]]></example>
  309. <p>Note the presence of <em>roster</em> permission request.</p>
  310. </section2>
  311. <section2 topic="Privileged Entity Receive Roster Presences" anchor='priv_rec_roster_presence'>
  312. <example caption="server receives new presence from Romeo, which is in Juliet's roster"><![CDATA[
  313. <presence from='romeo@montaigu.lit/orchard'/>
  314. ]]></example>
  315. <example caption='server sends the presence as usually, but also to the privileged entity'><![CDATA[
  316. <presence from='romeo@montaigu.lit/orchard'
  317. to='juliet@capulet.lit'/>
  318. <presence from='romeo@montaigu.lit/orchard'
  319. to='pubsub.capulet.lit'/>
  320. ]]></example>
  321. </section2>
  322. </section1>
  323. <section1 topic='Business Rules' anchor='rules'>
  324. <ol>
  325. <li>For "presence" access, if a privileged entity is connected after first &PRESENCE; stanzas have been received, the server MUST send it all the &PRESENCE; stanzas with no 'type' attribute it would have had if it was connected first (in other words: all the presences informations for connected entities it has access to).</li>
  326. <li>For "presence" access, if a privileged entity is supposed to received several time the same &PRESENCE; stanza, the server SHOULD send it only once. For example: if <em>pubsub.capulet.lit</em> has a "presence" access with a "roster" type for <em>capulet.lit</em>, and <em>juliet@capulet.lit</em> and <em></em> both have <em>romeo@montague.lit</em> in their roster. When romeo is available, <em>pubsub.capulet.lit</em> shoud have its &PRESENCE; stanza only once (instead of 2 times).</li>
  327. </ol>
  328. </section1>
  329. <section1 topic='Security Considerations' anchor='security'>
  330. <ol>
  331. <li>Privileged entitiy has access to sensitive data, and can act as the server itself, permissions should be granted carefuly, only if you absolutely trust the entity.</li>
  332. <li><link url='#roster_presence'>Roster presence</link> is particulary sensitive, because presence informations of whole rosters are shared.</li>
  333. <li>Generaly, the server MUST NOT allow the privileged entity to do anything that the managed entity could not do.</li>
  334. </ol>
  335. </section1>
  336. <section1 topic='IANA Considerations' anchor='iana'>
  337. <p>This document requires no interaction with &IANA;.</p>
  338. </section1>
  339. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  340. <section2 topic='Protocol Namespaces' anchor='ns'>
  341. <p>The &REGISTRAR; includes 'urn:xmpp:privilege:1' in its registry of protocol namespaces (see &NAMESPACES;).</p>
  342. <ul>
  343. <li>urn:xmpp:privilege:1</li>
  344. </ul>
  345. </section2>
  346. <section2 topic='Protocol Versioning' anchor='registrar-versioning'>
  347. &NSVER;
  348. </section2>
  349. </section1>
  350. <section1 topic='XML Schema' anchor='schema'>
  351. <code><![CDATA[
  352. <?xml version='1.0' encoding='UTF-8'?>
  353. <xs:schema
  354. xmlns:xs=''
  355. targetNamespace='urn:xmpp:privilege:1'
  356. xmlns='urn:xmpp:privilege:1'
  357. elementFormDefault='qualified'>
  358. <xs:element name='privilege'>
  359. <xs:complexType>
  360. <xs:element name='perm'
  361. maxOccurs='unbounded'>
  362. <xs:complexType>
  363. <xs:attribute name='access' use='required' type='xs:string'/>
  364. <xs:simpleType base='xs:NMTOKEN'>
  365. <xs:enumeration value='roster'/>
  366. <xs:enumeration value='message'/>
  367. <xs:enumeration value='presence'/>
  368. </xs:simpleType>
  369. <xs:attribute name='type' use='required'>
  370. <xs:simpleType base='xs:NMTOKEN'>
  371. <xs:enumeration value='none'/>
  372. <xs:enumeration value='get'/>
  373. <xs:enumeration value='set'/>
  374. <xs:enumeration value='both'/>
  375. <xs:enumeration value='outgoing'/>
  376. <xs:enumeration value='managed_entity'/>
  377. <xs:enumeration value='roster'/>
  378. </xs:simpleType>
  379. </xs:attribute>
  380. </xs:complexType>
  381. </xs:element>
  382. </xs:complexType>
  383. </xs:element>
  384. </xs:schema>
  385. ]]></code>
  386. </section1>
  387. <section1 topic='Acknowledgements' anchor='acks'>
  388. <p>Thanks to Sergey Dobrov, Dave Cridland, Steven Lloyd Watkin, Lance Stout, Johannes Hund, Kurt Zeilenga and Kevin Smith for their feedbacks. Thanks to Adrien Cossa for his typos/style corrections.</p>
  389. <p>Privileged entity was initialy written to be a generic identity based access control (IBAC) which allows an entity to access sensitive data. After <link url=''>a discussion on standard mailing list</link>, it has been decided to restrict the current XEP to immediate needs to build an external PEP service, and to implement separately an Attribute Based Access Control (ABAC) which is more modern, generic and flexible. This XEP is still interesting for being easy to implement and doing the job.</p>
  390. </section1>
  391. </xep>