XEP-xxxx: Privileged Components

Abstract:This specification provides a way for XMPP components to have a privileged access to entities data
Author:Jérôme Poisson
Copyright:© 1999 - 2014 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:ProtoXEP
Type:Standards Track
Version:0.0.1
Last Updated:2014-05-09

WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <http://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.


Table of Contents


1. Introduction
2. Requirements
3. Glossary
4. Admin Mode Use Cases
    4.1. Permission Request Use Case
       4.1.1. Component request privileged status of admin
       4.1.2. Server Accept Admin Privilege
       4.1.3. Server Reject Admin Privilege
    4.2. Privileged Component Send IQ Stanzas
5. Client Mode Use Cases
    5.1. Permission Request Use Case
    5.2. Privileged Component Send IQ Stanzas
6. Discovering Support
7. Business Rules
8. Implementation Notes
9. Security Considerations
10. IANA Considerations
11. XMPP Registrar Considerations
12. XML Schema

Appendices
    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: Revision History


1. Introduction

XMPP components are used for long through Jabber Component Protocol (XEP-0114) [1], 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.

Privileged component have numerous advantages, including:

2. Requirements

A privileged component can be used in two modes:

In admin mode, the component SHOULD be able to emit IQ stanzas in the same way as any entity, including managing roster or accessing persistent storage

In client 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.

3. Glossary

4. Admin Mode Use Cases

4.1 Permission Request Use Case

4.1.1 Component request privileged status of admin

Once the component is authentified and stream is started as explained in XEP-0114, the component can request its privileged status. It do it by sending an IQ stanza with 'urn:xmpp:tmp:privilege:0' namespace

Example 1. Component asks for admin privilege

<iq from='pubsub.capulet.net' type='get' id='privilege1'>
    <query xmlns='urn:xmpp:tmp:privilege:0' type='request' privilege='admin'/>
</iq>
            

4.1.2 Server Accept Admin Privilege

If the server accept the privileged status (e.g.: admin status specified in configuration), it MUST return empty IQ result stanza:

Example 2. Server accept admin privilege

<iq from='capulet.net' to='pubsub.capulet.net' type='result' id='privilege1' />
            

4.1.3 Server Reject Admin Privilege

If the server reject the privileged status, it MUST return a <forbidden/> error:

Example 3. Server reject admin privilege

<iq from='capulet.net' to='pubsub.capulet.net' type='error' id='privilege1'>
    <error type='cancel'>
        <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    </error>
</iq>
            

4.2 Privileged Component Send IQ Stanzas

Sending an IQ stanzas is done by remplacing the <iq/> with a <privilege/> element of namespace 'urn:xmpp:tmp:privilege:0', and including it in a global IQ stanza. The <privilege/> 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:

Example 4. Privileged Component Send A Roster Stanza

<iq from='pubsub.capulet.net' type='get' id='roster1'>
    <privilege xmlns='urn:xmpp:tmp:privilege:0'
        from='juliet@example.com'
        type='get'>
        <query xmlns='jabber:iq:roster'/>
    </privilege>
</iq>
            

The server then answer normaly, as it would have done with the client entity:

Example 5. Server Answer To Privileged Component

<iq id='roster1'
    to='pubsub.caputet.net'
    type='result'>
    <query xmlns='jabber:iq:roster' ver='ver7'>
        <item jid='nurse@example.com'/>
        <item jid='romeo@example.net'/>
    </query>
</iq>
            

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:

Example 6. Privileged Component Request Bookmarks

<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>
</iq>
            

and server answer:

Example 7. Server Return Bookmarks

<iq id='bookmark1'
    to='pubsub.caputet.net'
    type='result'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <items node='storage:bookmarks'>
      <item id='current'>
        <storage xmlns='storage:bookmarks'>
          <conference name='The Play&apos;s the Thing' 
                      autojoin='true'
                      jid='theplay@conference.shakespeare.lit'>
            <nick>JC</nick>
          </conference>
        </storage>
      </item>
    </items>
  </pubsub>
</iq>
            

5. Client Mode Use Cases

5.1 Permission Request Use Case

In client mode, the component is not certified by the server administrator, so the permissions MUST be explicitly 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 admin mode with the following exceptions:

  1. the privilege type is client instead of admin
  2. the privilege is done per entity, so the entity MUST be specified in a 'to' attribute
  3. permission are explicitly asked for every needed namespace

Namespace permission are asked with a <perm/> element, which MUST contain a 'xmlns' attribute and a 'type' attribute which can be:

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:

Example 8. Component Asks For User Privilege

<iq from='priv.montaigu.net' to='capulet.net' type='get' id='privilege1'>
    <query xmlns='urn:xmpp:tmp: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'/>
    </query>
</iq>

Once received the permission request, the server ask to the client if it grant access to the requested permission using Data Forms (XEP-0004) [2]. The form SHOULD allow to fine tune the granted permissions. The server use a challenge which it MUST have generated himself.

Example 9. Server Asks User For The Permission

<message from='capulet.net' to='juliet@capulet.net'>
    <body>
        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.
    </body>
    <x xmlns='jabber:x:data' type='form'>
        <title>Privileges request</title>
        <instructions>priv.montaigu.net wants to use the following features:
            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>
        </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='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>
        </field>
        <field type='list-single'
            label='Manage PubSub (http://jabber.org/protocol/pubsub) READ'
            var='http://jabber.org/protocol/pubsub'>
            <value>0</value>
            <option label='None'><value>none</value></option>
            <option label='Read only (get)'><value>get</value></option>
        </field>
    </x>
</message>

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 'none' (permission refused).

The client can then answer to the form:

Example 10. Client Answer To The Form

<message from='juliet@capulet.net' to='capulet.net'>
  <x xmlns='jabber:x:data' type='submit'>
    <field var='FORM_TYPE'>
      <value></value>
    </field>
    <field var='challenge'><value>5439123</value></field>
    <field var='jabber:iq:roster'><value>both</value></field>
    <field var='http://jabber.org/protocol/pubsub'><value>none</value></field>
  </x>
</message>

Here juliet accept that priv.montaigu.net use 'set' and 'get' to manage her roster, but doesn't want it to do any 'get' on her pubsub nodes.

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:

Example 11. Server notify accepted permissions

<iq from='capulet.net' to='priv.montaigu.net' type='set' id='privilege2'>
    <query xmlns='urn:xmpp:tmp:privilege:0'
        type='allowed'
        from='juliet@capulet.net'>
        <perm xmlns='jabber:iq:roster' type='both'/>
        <perm xmlns='http://jabber.org/protocol/pubsub' type='none'/>
    </query>
</iq>

The privileged component can now act according to permission granted to him.

5.2 Privileged Component Send IQ Stanzas

sending IQ stanza is done in the exact same way as for admin mode. If a component want to sent a non authorized IQ, it get a <forbidden/> error:

Example 12. Component Request bookmarks

<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>
</iq>

Example 13. The Stanza Is Not Autorized !

<iq from='capulet.net' to='priv.montaigu.net' type='error' id='bookmark1'>
    <error type='cancel'>
        <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
    </error>
</iq>
            

6. Discovering Support

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 Service Discovery (XEP-0030) [3] information request:

Example 14. Service Discovery information request

<iq from='pubsub.capulet.net'
    id='disco1'
    to='capulet.net'
    type='get'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
  

Example 15. Service Discovery information response

<iq from='capulet.net'
    id='disco1'
    to='pubsub.capulet.net'
    type='result'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='urn:xmpp:tmp:privilege:0'/>
    ...
  </query>
</iq>
  

7. Business Rules

  1. 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 Ad-Hoc Commands (XEP-0050) [4]).
  2. If a client can't check or revoke permission (e.g. it doesn't support XEP-0050), the server MUST NOT keep granted permission from one session to an other, and permission will be asked on each new session.

8. Implementation Notes

As admin mode is far more easy to implement than client mode, a server MAY choose to only implement the former

9. Security Considerations

  1. Privileged component nearly have the same possibility as the server itself, admin permission should be granted carefuly, only if you absolutely trust the component.
  2. 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 none
  3. 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)

10. IANA Considerations

REQUIRED. TODO

11. XMPP Registrar Considerations

REQUIRED. TODO

12. XML Schema

REQUIRED for protocol specifications. TODO


Appendices


Appendix A: Document Information

Series: XEP
Number: xxxx
Publisher: XMPP Standards Foundation
Status: ProtoXEP
Type: Standards Track
Version: 0.0.1
Last Updated: 2014-05-09
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0114, XEP-0004
Supersedes: None
Superseded By: None
Short Name: NOT_YET_ASSIGNED
This document in other formats: XML  PDF


Appendix B: Author Information

Jérôme Poisson

Email: goffi@goffi.org
JabberID: goffi@jabber.fr


Appendix C: Legal Notices

Copyright

This XMPP Extension Protocol is copyright (c) 1999 - 2014 by the XMPP Standards Foundation (XSF).

Permissions

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. In no event shall the XMPP Standards Foundation or the authors of this Specification be liable for any claim, damages, or other liability, whether in an action of contract, tort, or otherwise, arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification. ##

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 out of the use or inability to use 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 may be found at <http://xmpp.org/extensions/ipr-policy.shtml> or obtained by writing to XSF, P.O. Box 1641, Denver, CO 80201 USA).

Appendix D: Relation to XMPP

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.


Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.


Appendix F: Requirements Conformance

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


Appendix G: Notes

1. XEP-0114: Jabber Component Protocol <http://xmpp.org/extensions/xep-0114.html>.

2. XEP-0004: Data Forms <http://xmpp.org/extensions/xep-0004.html>.

3. XEP-0030: Service Discovery <http://xmpp.org/extensions/xep-0030.html>.

4. XEP-0050: Ad-Hoc Commands <http://xmpp.org/extensions/xep-0050.html>.


Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

Version 0.0.1 (2014-05-09)

First draft.

(jp)

END