diff --git a/xep-0356.xml b/xep-0356.xml index 6c54ac0e..96322369 100644 --- a/xep-0356.xml +++ b/xep-0356.xml @@ -10,7 +10,7 @@ This specification provides a way for XMPP entities to have a privileged access to some other entities data &LEGALNOTICE; 0356 - Deferred + Experimental Standards Track Standards Council @@ -26,6 +26,19 @@ goffi@goffi.org goffi@jabber.fr + + 0.4 + 2022-04-01 + jp + + + + 0.3 2017-09-11 @@ -105,7 +118,7 @@ -

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.

+

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;, &IQ; or receive &PRESENCE; stanzas in the name of the server.

Privileged entities have numerous advantages, including:

+

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".

-

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:1'. 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

+

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

@@ -167,24 +189,42 @@ to='juliet@example.com' type='get' id='roster1'> - + ]]>

The server then answers normally, as it would have done to the managed entity:

- - - - - + from='juliet@example.com' + to='pubsub.capulet.net' + type='result'> + + + + ]]>
+ + + +

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 &xmppim; with a 'from' attribute explicitely set to the bare jid of the managed entity.

+ + + + + + +]]> + +
+
@@ -194,7 +234,7 @@
  • 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 &xep0297;. The <forwarded/> element MUST be a child of a <privilege/> element with a namespace of 'urn:xmpp:privilege:1', with the following restriction:

    +

    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 <forwarded/> element MUST be a child of a <privilege/> element with a namespace of 'urn:xmpp:privilege:2', with the following restriction:

    1. forwarded &MESSAGE; 'from' attribute MUST be a bare JID from the server, no resource is allowed
    @@ -205,8 +245,8 @@

    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':

    - - + + @@ -217,56 +257,198 @@

    Now that pubsub.capulet.lit is allowed, it can send messages using <forwarded/> elements.

    - - - - - - - - Gerald Finzi - 255 - Music for "Love's Labors Lost" (Suite for small orchestra) - Introduction (Allegro vigoroso) - 1 - - - - - - - - + + + + + + + + Gerald Finzi + 255 + Music for "Love's Labors Lost" (Suite for small orchestra) + Introduction (Allegro vigoroso) + 1 + + + + + + + + ]]>

    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:

    - - - - - Gerald Finzi - 255 - Music for "Love's Labors Lost" (Suite for small orchestra) - Introduction (Allegro vigoroso) - 1 - - - - - + id='bar' + to='romeo@montague.lit/orchard'> + + + + + Gerald Finzi + 255 + Music for "Love's Labors Lost" (Suite for small orchestra) + Introduction (Allegro vigoroso) + 1 + + + + + ]]>
    + + + +

    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 &xep0376;.

    + +

    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 &xep0297; <forward> element encapsulated in a <privilege> element with a namespace of 'urn:xmpp'.

    +

    In following example, the pubsub component pubsub.capulet.lit handles &xep0376;. 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 &xmppcore;. It sends it back to pubsub.capulet.lit using a &xep0297; <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:

    @@ -276,7 +458,7 @@
  • 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 &rfc6121; section 4.6, on the behalf of managed entity each time its presence information change.

    -

    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.

    +

    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.

    @@ -285,22 +467,22 @@

    Once the "presence" permission is granted, the server send presence informations:

    - - chat - Staying on the balcony + id='presence1' + xml:lang='en'> + chat + Staying on the balcony ]]> - chat - Staying on the balcony + to='pubsub.capulet.lit' + id='presence1' + xml:lang='en'> + chat + Staying on the balcony ]]> @@ -319,11 +501,14 @@

    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"

    - - - - - + + + + + + + + ]]>

    Note the presence of roster permission request.

    @@ -353,6 +538,7 @@
    1. 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.
    2. Roster presence is particulary sensitive, because presence informations of whole rosters are shared.
    3. +
    4. IQ permission namespaces and types must be granted carefuly, as they allow component to act on behalf of any user of the server.
    5. Generaly, the server MUST NOT allow the privileged entity to do anything that the managed entity could not do.
    @@ -363,9 +549,9 @@ -

    The ®ISTRAR; includes 'urn:xmpp:privilege:1' in its registry of protocol namespaces (see &NAMESPACES;).

    +

    The ®ISTRAR; includes 'urn:xmpp:privilege:2' in its registry of protocol namespaces (see &NAMESPACES;).

      -
    • urn:xmpp:privilege:1
    • +
    • urn:xmpp:privilege:2
    @@ -378,39 +564,57 @@ + xmlns:xs='http://www.w3.org/2001/XMLSchema' + targetNamespace='urn:xmpp:privilege:2' + xmlns='urn:xmpp:privilege:2' + elementFormDefault='qualified'> - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - + + + ]]>