%ents; ]>
Entity Capabilities This document defines an XMPP protocol extension for broadcasting and discovering client, device, or generic entity capabilities in a way that minimizes network impact. &LEGALNOTICE; 0115 Draft Standards Track Standards XMPP Core XMPP IM XEP-0030 caps http://www.xmpp.org/schemas/caps.xsd &hildjj; &stpeter; &remko; 1.4pre2 in progress, last updated 2007-07-11 psa/jjh

In response to persistent security concerns over caps poisoning, defined method for hashing concatenation of identity and supported features.

1.3 2007-04-10 psa/rt/jjh

Added developer-friendly introduction; specified that ext names must be stable across application versions; further clarified examples; added stream feature use case; removed message example (send directed presence instead).

1.2 2007-02-15 psa

Clarified motivation and handling of service discovery requests.

1.1 2004-10-29 psa

Clarified meaning of service discovery results for client#ver and client#ext.

1.0 2004-08-01 psa

Per a vote of the Jabber Council, advanced status to Draft.

0.7 2004-06-29 jjh/psa

Added several items to the Security Considerations; clarified naming requirements regarding 'node', 'ver', and 'ext' attributes.

0.6 2004-04-25 psa

Made a number of editorial adjustments.

0.5 2004-01-05 psa

Specified that the protocol can be used whenever presence is used (e.g., by gateways); improved the XML schema; made several editorial adjustments.

0.4 2003-09-04 jjh

IQ eets must be to a resource, since they are intended to go to a particular session.

0.3 2003-09-02 jjh

Servers MUST strip extras changed to MAY, due to implementer feedback.

0.2 2003-08-28 jjh

Add more clarifying assumptions and requirements, make it clear that clients don't have to send capabilities every time if the server is optimizing.

0.1 2003-08-27 jjh

Initial version.

It is often desirable for a Jabber/XMPP application (commonly but not necessarily a client) to take different actions depending on the capabilities of another application from which it receives presence information. Examples include:

  • Showing a different set of icons depending on the capabilities of other clients.
  • Not sending &xep0071; content to plaintext clients such as cell phones.
  • Allowing the initiation of a Voice over IP (VoIP) session only to clients that support &xep0166; and &xep0167;.
  • Not showing a "Send a File" button if another user's client does not support &xep0096;.

Some older Jabber clients send one &xep0030; and one &xep0092; request to each entity from which they received presence after login. That "disco+version flood" results in an excessive use of bandwidth and is impractical on a larger scale, particularly for users or applications with large rosters. Therefore this document proposes a more robust and scalable solution: namely, a presence-based mechanism This proposal is not limited to clients, and can be used by any entity that exchanges presence with another entity, e.g., a gateway. However, this document uses the example of clients throughout. for exchanging information about entity capabilities. Clients SHOULD NOT engage in the older "disco+version flood" behavior and instead SHOULD use Entity Capabilities as specified herein.

This section provides a friendly, non-normative introduction to the workings of entity capabilities.

Imagine that you are a Shakespearean character named Juliet and one of your contacts, a handsome fellow named Romeo, becomes available. His client wants to publish its capabilities, and does this by adding a <c/> element to its presence packets. As a result, your client receives the following presence packet:

]]>

The 'node' attribute represents the client Romeo is using. The 'ver' attribute is a specially-constructed string that represents the identity (see &DISCOCATEGORIES;) and supported features (see &DISCOFEATURES;) of the entity.

At this point, your client has no idea what the capabilities are of someone with a client string 'http://exodus.jabberstudio.org/caps' and a version string '8RovUdtOmiAjzj+xI7SK5BCw3A8='. Your client therefore sends a service discovery query to Romeo, asking what his client can do.

]]>

The response is:

]]>

At this point, your client knows that anyone advertising a version string of '8RovUdtOmiAjzj+xI7SK5BCw3A8=' has a client that can do MUC. Your client remembers this information, so that it does not need to explicitly query the capabilities of a contact with the same version string. For example, Benvolio may send you the following presence:

]]>

Now your client automatically knows that Benvolio can do MUC, without needing to ask him explicitly via service discovery.

On the other hand, for a person with the following presence ...

]]>

... or the following presence ...

]]>

... you have no information about what this contact's client is capable of (as he is using a different client/version), and you therefore need to query for capabilities explicitly again via service discovery.

This document makes several assumptions:

The protocol defined herein addresses the following requirements:

  1. Clients MUST be able to participate even if they support only &xmppcore;, &xmppim;, and XEP-0030.
  2. Clients MUST be able to participate even if they are on networks without connectivity to other XMPP servers, services offering specialized XMPP extensions, or HTTP servers.These first two requirements effectively eliminated &xep0060; as a possible implementation of entity capabilities.
  3. Clients MUST be able to retrieve information without querying each user.
  4. Since presence is normally broadcasted to many users, the byte size of the proposed extension MUST be as small as possible.
  5. It MUST be possible to write a &xep0045; implementation that passes the given information along.
  6. It MUST be possible to publish a change in capabilities within a single session.
  7. Server infrastructure above and beyond that defined in XMPP Core and XMPP IM MUST NOT be required for this approach to work, although additional server infrastructure MAY be used for optimization purposes.

Entity capabilities are encapsulated in a <c/> element qualified by the 'http://jabber.org/protocol/caps' namespace. The attributes of the <c/> element are as follows:

Name Definition Inclusion
ext A set of nametokens specifying additional feature bundles; this attribute is deprecated. OPTIONAL
hash The hashing algorithm used in generated the 'ver' attribute (see &ianahashes;); the value defaults to "sha-1". OPTIONAL
node A unique identifier for the software underlying the entity, typically a URL at the website of the project or company that produces the software; required for backward-compatibility. REQUIRED
ver A string that specifies the identity and supported features of the entity. Before version 1.4 of this specification, the 'ver' attribute was used to specify the released version of the software. REQUIRED

In order to help prevent poisoning of entity capabilities information, the value of the 'ver' attribute MUST be generated according to the following method.

Note: All sorting operations MUST be performed using "i;octet" collation as specified in Section 9.3 of &rfc4790;.

  1. Initialize an empty string S.
  2. Sort the service discovery identities by category and then by type, formatted as "category" "/" "type".
  3. For each identity, append the category/type (if it exists) to S, followed by the '<' character.
  4. Sort the supported features.
  5. For each feature, append the feature to S, followed by the '<' character.
  6. Compute ver by hashing S using the SHA-1 algorithm as specified in &rfc3174; (with binary output) and encoding the hash using Base64 as specified in Section 4 of &rfc4648;.

For example, consider an entity whose service discovery category is "client", whose service discovery type is "pc", and whose supported features are "http://jabber.org/protocol/disco#info", "http://jabber.org/protocol/disco#items", and "http://jabber.org/protocol/muc". The value of the 'ver' attribute would be generated as follows:

  1. E = ''
  2. Only one identity: client/pc
  3. E = 'client/pc<'
  4. Sort the features: "http://jabber.org/protocol/disco#info", "http://jabber.org/protocol/disco#items", "http://jabber.org/protocol/muc".
  5. E = 'client/pc<http://jabber.org/protocol/disco#info<http://jabber.org/protocol/disco#items<http://jabber.org/protocol/muc<'
  6. ver = 8RovUdtOmiAjzj+xI7SK5BCw3A8=

Each time a conformant client sends presence, it annotates that presence with a client identifier ('node' attribute) and identity and feature identifier ('ver' attribute). Unless the server optimizations shown later are being used, the client MUST send this with every presence change (except for unavailable presence) to enable existing servers to remember the last presence for use in responding to probes.

If the supported features change during a client's session (e.g., a user installs an updated version of a client plugin), the application MUST recompute the 'ver' attribute and SHOULD send a new presence broadcast.

Note: The values of the 'node' and 'ver' attributes MUST NOT contain the '#' character, since that character is used as a separator in the Discovering Capabilities use case.

]]>

A contact can learn what features a user's client supports by sending a disco#info request (as defined in XEP-0030: Service Discovery) to any client that sent a particular value of the ver attribute.

]]>

The user then returns all of the capabilities supported by software.

]]>

The client MUST check the identities and supported features against the 'ver' value by calculating the hash as described under Generating the ver Attribute and making sure that the values match. If the values do not match, the client MUST NOT accept the 'ver' value as reliable and SHOULD check the value of another user who advertises that value (if any). This helps to prevent poisoning of entity capabilities information.

A server MAY include its own entity capabilities in a stream feature element so that connecting clients and peer servers do not need to send service discovery requests each time they connect:

]]>

A server that is managing an entity's session MAY choose to optimize traffic through the server. In this case, the server MAY strip off redundant capabilities annotations. Because of this, receivers of annotations MUST NOT expect an annotation on every presence packet they receive. If the server wants to perform this traffic optimization, it MUST ensure that the first presence each subscriber receives contains the annotation. The server MUST also ensure that any changes in the annotation (typically in the 'ext' attribute) are sent to all subscribers.

A client MAY query the server using disco#info to determine if the server supports the 'http://jabber.org/protocol/caps' feature. If so, the server MUST perform the optimization delineated above, and the client MAY choose to send the capabilities annotation only on the first presence packet, as well as whenever its capabilities change.

... ... ]]>

If two entities exchanges messages but they do not normally exchange presence (i.e., via presence subscription), the entities MAY choose to send directed presence to each other, where the presence information SHOULD be annotated with the same capabilities information as each entity sends in broadcasted presence. If capabilities information has not been received from another entity, an application MUST assume that the other entity does not support capabilities.

No application-specific error codes are defined by this document. See XEP-0030: Service Discovery for a list of potential service discovery error codes.

Use of the protocol specified in this document might make some client-specific forms of attack slightly easier, since the attacker could more easily determine the type of client being used. However, since most clients respond to jabber:iq:version requests without performing access control checks, there is no new vulnerability. Entities that wish to restrict access to capabilities information SHOULD use &xep0016; to define appropriate communications blocking (e.g., an entity MAY choose to allow IQ requests only from "trusted" entities, such as those with whom it has a subscription of "both").

Adherence to the algorithm defined in the Generation of ver Attribute sectio of this document helps to guard against poisoning of entity capabilities information by malicious or improperly implemented entities.

This document requires no interaction with &IANA;.

The ®ISTRAR; includes 'http://jabber.org/protocol/caps' in its registry of protocol namespaces (see &NAMESPACES;).

The protocol documented by this schema is defined in XEP-0115: http://www.xmpp.org/extensions/xep-0115.html ]]>

Before Version 1.4 of this specification, the 'node' attribute was required, the 'ver' attribute was generated differently, and the 'ext' attribute was used more extensively. For historical purposes, Version 1.3 of this specification is archived at <http://www.xmpp.org/extensions/attic/xep-0115-1.3.html>. For backward-compatibility with the legacy format, the 'node' attribute is REQUIRED and the 'ext' attribute MAY be included.

Thanks to Rachel Blackman, Dave Cridland, Richard Dobson, Sergei Golovan, Justin Karneges, Jacek Konieczny, Ian Paterson, Kevin Smith, Tomasz Sterna, and Michal Vaner for comments and suggestions.