Updating privilege-component protoXEP

This commit is contained in:
Ash Ward 2014-09-18 18:27:48 +01:00
parent 6477076d3a
commit b6eff145dc
1 changed files with 153 additions and 84 deletions

View File

@ -6,8 +6,8 @@
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Privileged Components</title>
<abstract>This specification provides a way for XMPP components to have a privileged access to entities data</abstract>
<title>Privileged Entity</title>
<abstract>This specification provides a way for XMPP entities to have a privileged access to other entities data</abstract>
<legal>
<copyright>This XMPP Extension Protocol is copyright (c) 1999 - 2014 by the XMPP Standards Foundation (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the &quot;Specification&quot;), 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.</permissions>
@ -34,6 +34,17 @@
<email>goffi@goffi.org</email>
<jid>goffi@jabber.fr</jid>
</author>
<revision>
<version>0.0.2</version>
<date>2014-09-17</date>
<initials>jp</initials>
<remark><ul>
<li>changed for privileged entity</li>
<li>fixes after feedbacks on standard mailing list</li>
<li>completed missing required parts</li>
</ul>
</remark>
</revision>
<revision>
<version>0.0.1</version>
<date>2014-05-09</date>
@ -42,47 +53,63 @@
</revision>
</header>
<section1 topic='Introduction' anchor='intro'>
<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 to have a "privileged" status, and access an entity data with the same privileges than the entity itself, that means send and receive IQ stanzas on its behalf.</p>
<p>Privileged component have numerous advantages, including:</p>
<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 an other entity data with the same privileges than the entity itself, that means send and receive IQ stanzas on its behalf.</p>
<p>Privileged entity have numerous advantages, including:</p>
<ul>
<li>a step forward in decentralization: it is possible for a component to do tasks which were before reserved to server itself. For example, a privileged pubsub component can offer roster access model</li>
<li>better integration of component: a gateway can add items to an entity roster itslef</li>
<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>
<li>better integration of components: a gateway can add items to an entity roster itself</li>
<li>possibility to overpass a server limitation</li>
<li>quick development cycle: developers can implement the component they need without waiting for a new server release</li>
<li>quick development cycle: developers can implement the components they need without waiting for a new server release</li>
<li>server agnostic</li>
</ul>
</section1>
<section1 topic='Requirements' anchor='reqs'>
<p>A privileged component can be used in two modes:</p>
<p>A privileged entity can be used in two modes:</p>
<ul>
<li><strong>admin</strong> mode, where it is installed by the server administrator</li>
<li><strong>client</strong> mode, where it can be installed by any user</li>
</ul>
<p>In <em>admin</em> mode, the component SHOULD be able to emit IQ stanzas in the same way as any entity, including managing roster or accessing persistent storage</p>
<p>In <em>client</em> mode, a component MUST have an explicit autorization for any IQ namespace he wants to use. Client MUST be able to check and revoke granted permssions.</p>
<p>In <em>admin</em> mode, the privileged entity MAY be able to emit IQ stanzas in the same way as any entity, including managing roster or accessing persistent storage.</p>
<p>In <em>client</em> mode, a privileged entity MUST have an explicit autorization for any IQ namespace he wants to use. Client SHOULD be able to check and revoke granted permissions, and if it's not possible, permissions MUST be revoked after a disconnection.</p>
</section1>
<section1 topic='Glossary' anchor='glossary'>
<ul>
<li><strong>Component</strong> — the privileged component.</li>
<li><strong>Client</strong> — the entity that the component wants to manage.</li>
<li><strong>Privileged entity</strong> — the entity which has or wants a privileged status.</li>
<li><strong>Managed entity</strong> — the entity that the privileged entity wants to manage.</li>
</ul>
</section1>
<section1 topic='Admin Mode Use Cases' anchor='admin_usecases'>
<section2 topic='Permission Request Use Case' anchor='admin_perm'>
<section3 topic='Component request privileged status of admin' anchor='req_status'>
<p>Once the component is authentified and stream is started as explained in <strong>XEP-0114</strong>, the component can request its privileged status. It do it by sending an IQ stanza with <strong>'urn:xmpp:tmp:privilege:0'</strong> namespace</p>
<example caption='Component asks for admin privilege'><![CDATA[
<section3 topic='Entity request privileged status of admin' anchor='req_status'>
<p>Once the privileged entity is authentified and stream is started, the entity can request its privileged status. It do it by sending an IQ stanza with <strong>'urn:xmpp:privilege:0'</strong> namespace</p>
<p>Namespace permissions are asked with a &lt;perm/&gt; element, which MUST contain a 'namespace' attribute set to the requested namespace and a 'type' attribute which can be:</p>
<ul>
<li><strong>get</strong> — the entity wants to send &IQ; stanza of type <em>'get'</em></li>
<li><strong>set</strong> — the entity wants to send &IQ; stanza of type <em>'set'</em></li>
<li><strong>both</strong> — the entity wants to send &IQ; stanza of type <em>'get'</em> and <em>'set'</em></li>
</ul>
<example caption='Entity asks for admin privilege'><![CDATA[
<iq from='pubsub.capulet.net' type='get' id='privilege1'>
<query xmlns='urn:xmpp:tmp:privilege:0' type='request' privilege='admin'/>
<query xmlns='urn:xmpp:privilege:0' type='request' privilege='admin'>
<perm namespace='jabber:iq:roster' type='both'/>
<perm namespace='http://jabber.org/protocol/pubsub' type='both'/>
</query>
</iq>
]]></example>
</section3>
<section3 topic='Server Accept Admin Privilege' anchor='accept_status'>
<p>If the server accept the privileged status (e.g.: admin status specified in configuration), it MUST return empty IQ result stanza:</p>
<p>If the server accept the privileged status (e.g.: admin status specified in configuration), it MUST return an IQ result stanza, with allowed permissions in &lt;perm/&gt; elements:</p>
<example caption='Server accept admin privilege'><![CDATA[
<iq from='capulet.net' to='pubsub.capulet.net' type='result' id='privilege1' />
]]></example>
<iq from='capulet.net' to='pubsub.capulet.net' type='result' id='privilege1'>
<query xmlns='urn:xmpp:privilege:0'
type='allowed'>
<perm namespace='jabber:iq:roster' type='both'/>
<perm namespace='http://jabber.org/protocol/pubsub' type='both'/>
</query>
</iq>
]]></example>
<p>Note: the granted permissions MAY be different from the requested ones, according to server's configuration.</p>
</section3>
<section3 topic='Server Reject Admin Privilege' anchor='reject_status'>
<p>If the server reject the privileged status, it MUST return a &forbidden; error:</p>
@ -96,22 +123,22 @@
</section3>
</section2>
<section2 topic='Privileged Component Send IQ Stanzas' anchor='priv_iq_admin'>
<p>Sending an IQ stanzas is done by remplacing the &IQ; with a &lt;privilege/&gt; element of namespace <strong>'urn:xmpp:tmp:privilege:0'</strong>, and including it in a global IQ stanza. The &lt;privilege/&gt; element is then similar to the IQ stanza the client would have sent. In the following example, the PubSub service want to know juliet's roster because she own a node with roster access model:</p>
<example caption='Privileged Component Send A Roster Stanza'><![CDATA[
<iq from='pubsub.capulet.net' type='get' id='roster1'>
<privilege xmlns='urn:xmpp:tmp:privilege:0'
from='juliet@example.com'
type='get'>
<section2 topic='Privileged Entity Send IQ Stanzas' anchor='priv_iq_admin'>
<p>Sending an IQ stanzas is done by sending the stanza the way it would be done by the managed entity, except that its jid is in the 'to' attribute. In the following example, the PubSub service want to know juliet's roster because she own a node with access model based on publiser's roster:</p>
<example caption='Privileged Entity Send A Roster Stanza'><![CDATA[
<iq id='roster1'
xmlns='urn:xmpp:privilege:0'
to='juliet@example.com'
type='get'
id='roster1'>
<query xmlns='jabber:iq:roster'/>
</privilege>
</iq>
]]></example>
<p>The server then answer normaly, as it would have done with the client entity:</p>
<example caption='Server Answer To Privileged Component'><![CDATA[
<p>The server then answer normaly, as it would have done with the managed entity:</p>
<example caption='Server Answer To Privileged Entity'><![CDATA[
<iq id='roster1'
to='pubsub.caputet.net'
to='pubsub.capulet.net'
type='result'>
<query xmlns='jabber:iq:roster' ver='ver7'>
<item jid='nurse@example.com'/>
@ -120,23 +147,21 @@
</iq>
]]></example>
<p>In the following example, the sync.capulet.net privileged component want to access client's bookmarks to synchronize them with an online service. It can request the bookmarks in the following way:</p>
<example caption='Privileged Component Request Bookmarks'><![CDATA[
<iq from='pubsub.capulet.net' type='get' id='bookmark1'>
<privilege xmlns='urn:xmpp:tmp:privilege:0'
from='juliet@capulet.lit'
type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='storage:bookmarks'/>
</pubsub>
</privilege>
<p>In the following example, the sync.capulet.net privileged entity want to access managed entity's bookmarks to synchronize them with an online service. It can request the bookmarks in the following way:</p>
<example caption='Privileged Entity Request Bookmarks'><![CDATA[
<iq id='bookmark1'
to='juliet@capulet.lit'
type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='storage:bookmarks'/>
</pubsub>
</iq>
]]></example>
<p>and server answer:</p>
<example caption='Server Return Bookmarks'><![CDATA[
<iq id='bookmark1'
to='pubsub.caputet.net'
to='pubsub.capulet.net'
type='result'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='storage:bookmarks'>
@ -159,28 +184,21 @@
<section1 topic='Client Mode Use Cases' anchor='client_usecases'>
<section2 topic='Permission Request Use Case' anchor='client_perm'>
<p>In <em>client</em> mode, the component is not certified by the server administrator, so the permissions MUST be <strong>explicitly</strong> allowed by the client. This is initiated by the component (it can be after an interaction with a client, like a subscription). It's done in a the same way as for <em>admin</em> mode with the following exceptions:</p>
<p>In <em>client</em> mode, the privileged entity is not certified by the server administrator, so the permissions MUST be <strong>explicitly</strong> allowed by the managed entity. This is initiated by the privileged entity (it can be after an interaction with a managed entity, like a subscription). It's done in the same way as for <em>admin</em> mode with the following exceptions:</p>
<ol>
<li>the privilege type is <em>client</em> instead of <em>admin</em></li>
<li>the privilege is done per entity, so the entity MUST be specified in a 'to' attribute</li>
<li>permission are explicitly asked for every needed namespace</li>
<li>the privilege is done per entity, so the managed entity MUST be specified in a 'to' attribute</li>
</ol>
<p>Namespace permission are asked with a &lt;perm/&gt; element, which MUST contain a 'xmlns' attribute and a 'type' attribute which can be:</p>
<ul>
<li><strong>get</strong> — the component wants to send &IQ; stanza of type <em>'get'</em></li>
<li><strong>set</strong> — the component wants to send &IQ; stanza of type <em>'set'</em></li>
<li><strong>both</strong> — the component wants to send &IQ; stanza of type <em>'get'</em> and <em>'set'</em></li>
</ul>
<p>If a component want a read/write access to a client's roster (juliet) and a read only access to her pubsub, it can ask the permission like this:
<p>If an entity want a read/write access to a client's roster (juliet) and a read only access to her pubsub, it can ask the permission like this:
</p>
<example caption='Component Asks For User Privilege'><![CDATA[
<example caption='Entity Asks For User Privilege'><![CDATA[
<iq from='priv.montaigu.net' to='capulet.net' type='get' id='privilege1'>
<query xmlns='urn:xmpp:tmp:privilege:0'
<query xmlns='urn:xmpp:privilege:0'
type='request'
privilege='client'
to='juliet@capulet.net'>
<perm xmlns='jabber:iq:roster' type='both'/>
<perm xmlns='http://jabber.org/protocol/pubsub' type='get'/>
<perm namespace='jabber:iq:roster' type='both'/>
<perm namespace='http://jabber.org/protocol/pubsub' type='get'/>
</query>
</iq>
]]></example>
@ -192,8 +210,8 @@
priv.montaigu.net wants some privileges.
Do you you allow him to use the following features ?
Be careful ! According permissions to component is a serious thing,
think twice that you can trust the component before doing this.
Be careful ! According permissions to entity is a serious thing,
think twice that you can trust the entity before doing this.
</body>
<x xmlns='jabber:x:data' type='form'>
<title>Privileges request</title>
@ -201,13 +219,13 @@
Do you allow it?</instructions>
<field type='hidden' var='challenge'><value>5439123</value></field>
<field type='hidden' var='FORM_TYPE'>
<value>urn:xmpp:tmp:privilege:0</value>
<value>urn:xmpp:privilege:0</value>
</field>
<field type='list-single'
label='Manage roster (jabber:iq:roster) READ/WRITE'
var='jabber:iq:roster'>
<value>0</value>
<option label='No'><value>0</value></option>
<option label='None'><value>none</value></option>
<option label='Read only (get)'><value>get</value></option>
<option label='Write only (set)'><value>set</value></option>
<option label='Read and write (both)'><value>both</value></option>
@ -222,7 +240,7 @@
</x>
</message>
]]></example>
<p>The server SHOULD include a warning message, SHOULD translate the namespace to human friendly names (and MAY keep the original namespace in addition) and MUST set the default value to '<strong>none</strong>' (permission refused).</p>
<p>The server SHOULD include a warning message, SHOULD translate the namespace to human friendly names (and MAY keep the original namespace in addition) and MUST set the default value to '<strong>none</strong>' (permission refused). The server SHOULD use namespace as field var, so a client can use it to have a customized display.</p>
<p>The client can then answer to the form:</p>
<example caption='Client Answer To The Form'><![CDATA[
<message from='juliet@capulet.net' to='capulet.net'>
@ -237,30 +255,26 @@
</message>
]]></example>
<p>Here juliet accept that <em>priv.montaigu.net</em> use 'set' and 'get' to manage her roster, but doesn't want it to do any 'get' on her pubsub nodes.</p>
<p>Finaly, the server notify the component of the permission granted. For this it use a &QUERY; element with the 'allowed' type, and put the client jid in a 'from' attribute:</p>
<p>Finaly, the server notify the entity of the permissions granted. For this it use a &QUERY; element with the 'allowed' type, and put the client jid in a 'from' attribute:</p>
<example caption='Server notify accepted permissions'><![CDATA[
<iq from='capulet.net' to='priv.montaigu.net' type='set' id='privilege2'>
<query xmlns='urn:xmpp:tmp:privilege:0'
<query xmlns='urn:xmpp:privilege:0'
type='allowed'
from='juliet@capulet.net'>
<perm xmlns='jabber:iq:roster' type='both'/>
<perm xmlns='http://jabber.org/protocol/pubsub' type='none'/>
<perm namespace='jabber:iq:roster' type='both'/>
<perm namespace='http://jabber.org/protocol/pubsub' type='none'/>
</query>
</iq>
]]></example>
<p>The privileged component can now act according to permission granted to him.</p>
<p>The privileged entity can now act according to permission granted to him.</p>
</section2>
<section2 topic='Privileged Component Send IQ Stanzas' anchor='priv_iq_client'>
<p>sending IQ stanza is done in the exact same way as for <link url='#priv_iq_admin'>admin mode</link>. If a component want to sent a non authorized IQ, it get a &forbidden; error:</p>
<example caption='Component Request bookmarks'><![CDATA[
<iq from='priv.montaigu.net' to='capulet.net' type='get' id='bookmark1'>
<privilege xmlns='urn:xmpp:tmp:privilege:0'
from='juliet@capulet.lit'
type='get'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='storage:bookmarks'/>
</pubsub>
</privilege>
<section2 topic='Privileged Entity Send IQ Stanzas' anchor='priv_iq_client'>
<p>sending IQ stanza is done in the exact same way as for <link url='#priv_iq_admin'>admin mode</link>. If an entity want to sent a non authorized IQ, it get a &forbidden; error:</p>
<example caption='Entity Request bookmarks'><![CDATA[
<iq to='juliet@capulet.lit' type='get' id='bookmark1'>
<pubsub xmlns='http://jabber.org/protocol/pubsub'>
<items node='storage:bookmarks'/>
</pubsub>
</iq>
]]></example>
@ -275,7 +289,7 @@
</section1>
<section1 topic='Discovering Support' anchor='disco'>
<p>If a server or a component supports the component privilege protocol, it MUST report that fact by including a service discovery feature of "urn:xmpp:tmp:privilege:0" in response to a &xep0030; information request:</p>
<p>If a server or an entity supports the entity privilege protocol, it MUST report that fact by including a service discovery feature of "urn:xmpp:privilege:0" in response to a &xep0030; information request:</p>
<example caption="Service Discovery information request"><![CDATA[
<iq from='pubsub.capulet.net'
id='disco1'
@ -291,7 +305,7 @@
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='urn:xmpp:tmp:privilege:0'/>
<feature var='urn:xmpp:privilege:0'/>
...
</query>
</iq>
@ -299,8 +313,9 @@
</section1>
<section1 topic='Business Rules' anchor='rules'>
<ol>
<li>Server MAY keep permission granted to an component by a client from one session to an other, but if it do so, it MUST provide a way to client to check already granted permission, and revoke them (possibly using &xep0050;).</li>
<li>If a client can't check or revoke permission (e.g. it doesn't support <strong>XEP-0050</strong>), the server MUST NOT keep granted permission from one session to an other, and permission will be asked on each new session.</li>
<li>Server MAY keep permission granted to an entity by a client from one session to an other, but if it do so, it MUST provide a way to client to check already granted permission, and revoke them (possibly using &xep0050;).</li>
<li>If a client can't check or revoke permission (e.g. it doesn't support &xep0050;), the server MUST NOT keep granted permission from one session to an other, and permission will be asked on each new session.</li>
<li>If permissions are changed during a session, server MUST notify privileged entity of the new permissions, like in <link url='#client_perm'>permission request use case</link> </li>
</ol>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
@ -308,19 +323,73 @@
</section1>
<section1 topic='Security Considerations' anchor='security'>
<ol>
<li>Privileged component nearly have the same possibility as the server itself, <em>admin</em> permission should be granted carefuly, only if you absolutely trust the component.</li>
<li>Privileged entity nearly have the same possibility as the server itself, <em>admin</em> permission should be granted carefuly, only if you absolutely trust the entity.</li>
<li>A server MAY choose to filter allowed namespaces, to avoid giving dangerous permissions. In this case, it MUST always set the allowed type of filtered namespaces to <strong>none</strong></li>
<li>In case of filtering, a whitelist system is more secure and SHOULD be prefered to a blacklist (idealy, configuration would allow no filtering, whitelist filtering and blacklist filtering)</li>
</ol>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
<p>REQUIRED. TODO</p>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
<p>REQUIRED. TODO</p>
<section2 topic='Protocol Namespaces' anchor='ns'>
<p>The &REGISTRAR; includes 'urn:xmpp:privilege:0' in its registry of protocol namespaces (see &NAMESPACES;).</p>
<ul>
<li>urn:xmpp:privilege:0</li>
</ul>
</section2>
<section2 topic='Protocol Versioning' anchor='registrar-versioning'>
&NSVER;
</section2>
</section1>
<section1 topic='XML Schema' anchor='schema'>
<p>REQUIRED for protocol specifications. TODO</p>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='urn:xmpp:privilege:0'
xmlns='urn:xmpp:privilege:0'
elementFormDefault='qualified'>
<xs:element name='query'>
<xs:complexType>
<xs:attribute name='type' use='required'>
<xs:simpleType base='xs:NMTOKEN'>
<xs:enumeration value='request'/>
<xs:enumeration value='allowed'/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name='privilege' use='optional'>
<xs:simpleType base='xs:NMTOKEN'>
<xs:enumeration value='admin'/>
<xs:enumeration value='client'/>
</xs:simpleType>
</xs:attribute>
<xs:attribute name='to' use='optional' type='xs:string'/>
</xs:attribute>
<xs:element name='perm'
maxOccurs='unbounded'>
<xs:complexType>
<xs:attribute name='namespace' use='required' type='xs:string'/>
<xs:attribute name='type' use='required'>
<xs:simpleType base='xs:NMTOKEN'>
<xs:enumeration value='none'/>
<xs:enumeration value='get'/>
<xs:enumeration value='set'/>
<xs:enumeration value='both'/>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:complexType>
</xs:element>
</xs:schema>
]]></code>
</section1>
<section1 topic='Acknowledgements' anchor='acks'>
<p>Thanks to Sergey Dobrov, Dave Cridland and Steven Lloyd Watkin for their feedbacks.</p>
</section1>
</xep>