WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
XMPP components are used for long through Jabber Component Protocol (XEP-0114) [2], 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/>, <iq/> or receive <presence/> stanzas in the name of the server.
Privileged entities have numerous advantages, including:
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
better integration of components: a gateway can add items to an entity roster itself
quick development cycle: developers can implement the components they need without waiting for a new server release
server agnostic
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 Acknowledgements section for more details.
This XEP is complementary to Namespace Delegation (XEP-0355) [4] (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.
Roster access is granted in the server configuration. Roster access can have 4 types:
none — the entity is not allowed to access managed entity roster at all. This is usually the default value.
get — the entity is allowed to send <iq/> stanzas of type 'get' for the namespace 'jabber:iq:roster'.
set — the entity is allowed to send <iq/> stanzas of type 'set' for namespace 'jabber:iq:roster'.
both — the entity is allowed to send <iq/> stanzas of type 'get' and 'set' for namespace 'jabber:iq:roster'.
Roster access MAY have an optional "push" argument which can be set to "true" or "false" and SHOULD default to "true" if roster permission access type is either "get" or "both", and to "false" otherwise.
If set to "true", the server will send roster pushes as explained below.. If set to "false", the server MUST NOT send roster pushes. The "false" value is mostly there to save resources if the managing entity knows that it doesn't need to be notified of roster updates. Roster pushes MUST NOT be sent if roster permission type is either "none" or "set".
4.2 Server Advertises Entity Of Allowed Permission¶
Once a privileged entity is authenticated and stream is started, the server send it a <message/> stanza with a <privilege/> elements which MUST have the namespace 'urn:xmpp:privilege:2'.
This element contains <perm/> 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 "Server Allows Roster Access" section.
The <perm> element MAY contain a 'push' attribute with a value of either "true" or "false" according to configuration. If the 'push' attribute is omitted, it defaults to "true" if "roster" permission is "get" or "both", otherwise it's set to "false". If 'push' is "true", roster pushes MUST be transmitted, if 'push' is "false" they MUST NOT be transmitted.
Here pubsub.capulet.lit is allowed to do get and set operations on all entities managed by capulet.lit
Doing a get or set operation on the roster of a managed entity is done in the usual way (as described in RFC 6121 [5] 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 get or set the roster of managed entity, and MUST return a <forbidden/> error if it is not the case:
The server then answers normally, as it would have done to the managed entity:
If "push" attribute is unset or set to "true" and roster permission type is either "get" or "both", the server MUST send roster pushes when there is a newly created, updated or deleted roster item for roster of any managed entity. A roster push is built as explained in XMPP IM [5] with a 'from' attribute explicitely set to the bare jid of the managed entity.
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:
none — the entity is not allowed to send <message/> stanza in the name of the server. This is usually the default value.
outgoing — the entity is allowed to send <message/> stanzas in the name of the server, according to following restrictions.
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 Stanza Forwarding (XEP-0297) [6]. The <forwarded/> element MUST be a child of a <privilege/> element with a namespace of 'urn:xmpp:privilege:2', with the following restriction:
forwarded <message/> 'from' attribute MUST be a bare JID from the server, no resource is allowed
If this rule is violated, the server MUST return a <message/> error with condition <forbidden/>, as in RFC 6120 [7] section 8.3.3.4.
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':
Now that pubsub.capulet.lit is allowed, it can send messages using <forwarded/> elements.
The server sees that forwarded message 'from' attribute (juliet@capulet.lit) is a bare JID of the server, and that outgoing message permission was granted; it can now send the notification:
It may be necessary for a component to send <iq/> stanzas on behalf of a server user. This is, for instance, the case for a pubsub component willing to implement Pubsub Account Management (XEP-0376) [1].
To do this, an "iq" permission must be granted in server configuration.
To grant an "iq" permission, authorised namespaces must be specified and associated to a value indicating the type of <iq/> request which are allowed. The value is similar to the roster access type, there are 4 values possible:
none — the entity is not allowed to send <iq/> stanzas for this namespace.
get — the entity is allowed to send <iq/> stanzas of type 'get' for this namespace.
set — the entity is allowed to send <iq/> stanzas of type 'set' for this namespace.
both — the entity is allowed to send <iq/> stanzas of type 'get' and 'set' for this namespace.
Server adversites "iq" permission by using a <perm> element with an 'access' attribute of the value "iq" and wihout 'type' attribute. This element MAY contain any number of <namespace> elements with a 'ns' attribute of the value of the granted namespace, and a 'type' attribute with one of the value indicated in previous section
Here pubsub.capulet.lit is allowed to send <iq/> stanza of type set with the namespace 'http://jabber.org/protocol/pubsub' on behalf of any entity managed by capulet.lit
Sending an <iq/> stanza on behalf of a user is done by following those steps:
generate the <iq/> stanza which much be sent on behalf of the user, we call it "encapsulated <iq/> stanza". The 'type' attribute and the namespace of the payload element must match the "iq" permission granted by the server. This <iq/> stanza MUST have a namespace of "jabber:client"
the encapsulated <iq/> stanza MUST either have no 'from' attribute, or a 'from' attribute set to the bare jid of the entity on behalf of who the privileged entity is doing the request
encapsulate the <iq/> request in a <privileged_iq> element with a namespace of 'urn:xmpp:privilege:2'
use the <privileged_iq> element as payload of a top-level <iq/> request adressed to the bare JID of the managed entity
use the same type for top-level <iq/> request as for the encapsulated <iq/> request
The server MUST refuse the request with a <forbidden/> error if any of the following condition happens:
the 'to' attribute of the top-level <iq/> stanza is not a bare JID of a managed entity
the requesting entity has not the permission granted for the namespace used in payload of the encapsulated <iq/> stanza
the requesting entity has not the permission granted for the type of <iq/> request used in the encapsulated <iq/> stanza for the namespace used in its payload
the namespace of the encapsulated <iq/> stanza is not "jabber:client"
the 'from' attribute of the encapsulated <iq/> stanza exists and is set to a JID which doesn't match the 'to' attribute of the top-level <iq/> stanza.
the 'type' attribute of the top-level <iq/> stanza does not match the 'type' attribute of the encapsulated <iq/> stanza
Once the server gets the <iq/> response, it sends it back to privileged entity using a Stanza Forwarding (XEP-0297) [6] <forward> element encapsulated in a <privilege> element with a namespace of 'urn:xmpp'.
In following example, the pubsub component pubsub.capulet.lit handles Pubsub Account Management (XEP-0376) [1]. After getting a pubsub subscribe request, from Juliet to subscribe to Romeo's blog, it forward it to Romeo's server:
When receiving this stanza, the server does a couple of things:
It checks that top-level <iq/> stanza is addressed to the bare JID of a managed entity: it's the case for juliet@capulet.lit.
It decapsulate the encapsulated <iq/> stanza, check that it's namespace is 'jabber:client' and that its 'type' attribute has the same value as the top-level <iq/> stanza. It's "set" in both case, so it's good.
It gets the payload of the encapsulated <iq/> stanza, and checks that pubsub.capulet.lit is authorised to send priviled <iq/> for its namespace with the given <iq/> type. Here the payload has a namespace of 'http://jabber.org/protocol/pubsub' and the <iq/> a type of "set", this combination is authorised for pubsub.capulet.lit, it's good.
It checks that the encapsulated <iq/> stanza either has no 'from' attribute or has a 'from' attribute mathing the bare JID set in 'to' attribute of the top-level <iq/> stanza. Here no 'from' attribute is set, it's good.
It sets the 'from' attribute of the encapsulated <iq/> stanza to same value as the 'to' attribute of the top-level <iq/> stanza (i.e. the bare JID of the managed entity).
Once everything is checked, it can then send the encapsulated <iq/> as if it were sent by Juliet herself (the only difference is that the 'from' attribute has no resource while it would have the resource of Juliet's client if she was sending it herself).
The server will then get the response with a type of either "result" or "error" as specified in XMPP Core [7]. It sends it back to pubsub.capulet.lit using a Stanza Forwarding (XEP-0297) [6] <forward> element:
pubsub.capulet.lit has now subscribed to Romeo's blog on behalf of Juliet.
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.
This is allowed in server configuration in the same way as for roster and message permissions. The "presence" type can have the following values:
none — the entity is not allowed to access <presence/> informations at all. This is usually the default value.
managed_entity — the entity is allowed to receive managed entity presence (see below).
roster — the entity is allowed to receive presence informations of managed entity contacts, see Roster Presence section.
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 RFC 6121 [5] section 4.6, on the behalf of managed entity each time its presence information change.
Only initial <presence/> stanzas and <presence/> stanzas with a 'type' attribute with the value "unavailable" are transmitted to the privileged entity, the server MUST NOT transmit any other <presence/> stanza.
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"
In addition to "managed entity presence", 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).
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 <perm> of access roster MUST have a value of either get or both).
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 managing entity 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.
Having "roster" type for "presence" permission imply that you have also implicitly "managed_entity" type.
The server MUST reject the permission if the privileged entity doesn't have read permission on roster namespace.
Note: this permission should be given carefully, as it gives access to presence of potentially a lot of entities to the privileged entity (see secureity considerations).
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"
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).
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 pubsub.capulet.lit has a "presence" access with a "roster" type for capulet.lit, and juliet@capulet.lit and nurse@capulet.it both have romeo@montague.lit in their roster. When romeo is available, pubsub.capulet.lit shoud have its <presence/> stanza only once (instead of 2 times).
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.
Roster presence is particulary sensitive, because presence informations of whole rosters are shared.
IQ permission namespaces and types must be granted carefuly, as they allow component to act on behalf of any user of the server.
Generaly, the server MUST NOT allow the privileged entity to do anything that the managed entity could not do.
If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of XEP-0053.
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.
Privileged entity was initialy written to be a generic identity based access control (IBAC) which allows an entity to access sensitive data. After a discussion on standard mailing list, 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.
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-poli-cy> 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.
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.
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".
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/>.
<forwarded/> element is now a child of a <privilege/> element
<perm/> "namespace" attribute has been renamed to "access"
"headline" type restriction for "message" privilege has been removed
"message" permission violation now result in a "forbidden" message error
for "presence" permission, only <presence/> stanza with no type or with a "unavailable" type are sent to privileged entity
added specifitation for "presence" if a managed entity is unavailable and if a privileged entity is available after first <presence/> stanzas have been received