%ents; ]>
Message Carbons In order to keep all IM clients for a user engaged in a conversation, outbound messages are carbon-copied to all interested resources. &LEGALNOTICE; 0280 Draft 2021-04-06 2020-04-08 2019-01-22 2018-02-22 2017-03-28 2017-03-01 2017-02-22 2015-08-28 Standards Track Standards Council XMPP Core XMPP IM XEP-0001 XEP-0030 XEP-0085 XEP-0297 XEP-0259 carbons Joe Hildebrand jhildebr@cisco.com jhildebr@cisco.com Matthew Miller linuxwolf@outer-planes.net linuxwolf@outer-planes.net Georg Lukas georg@op-co.de georg@yax.im 1.0.1 2021-12-26 egp

Fix indentation in examples.

1.0.0 2021-10-12 jsc (XEP Editor)

Advance to Stable as per Council Vote from 2021-09-29. Unbelievable.

0.14.0 2021-09-28 gl

Incorporate LC feedback: Remove requirement to remove "private" elements (and add interop note), completely reword mobile considerations to fit modern reality.

0.13.4 2021-05-25 gl

Add CVE references

0.13.3 2021-03-23 gl

Add Georg as author as discussed on-list.

0.13.2 2019-12-16 sp

Typographical fix.

0.13.1 2019-09-11 gl

Add clear example on problematic (spoofed) carbon messages and that they need to be handled.

0.13.0 2019-04-24 gl

Create more explicit and more binding copying rules under the "urn:xmpp:carbons:rules:0" namespace:

  • Replace MAY with MUST if feature is advertised.
  • Include XEP-0085 and XEP-0184 as eligible for carbon-copying.
  • Specify explicit rules for MUC related messages.
0.12.1 2019-03-14 ka

Fix off-by-one in dependencies.

0.12.0 2017-02-16 gl

Improved readability by restructuring long sentences (Stefan Haun).

Removed ambiguous "forking" term; forbidden the reliance of error handling on the content of a bounced message.

0.11.0 2017-01-27 gl (XEP Editor: ssw)

Added <no-copy/> hint.

0.10.1 2016-02-16 mm (editor)

Fixed typo in XML Schema ("dx").

0.10 2015-08-24 mm (editor)

Removed distinction between full-JID and bare-JID when receiving messages (Georg Lukas).

Define rules around "eligible messages", and provide reasonable default guidelines (Kevin Smith).

0.9 2013-10-17 mm

Reorganized to emphasize uses; removed discussion on error conditions required of "non-supporting" entities; relaxed multiple enables/disables to effectively no-ops; removed requirement for <private/> to be stripped from messages processed by the sending server; reworded "Interaction with Chat States" to be consistent with RFC 2119 language; updated mobile considerations to include battery life; changed all examples to use ".example" for the domainpart.

0.8 2012-10-09 mm

Updated use case text to match schema and examples.

0.7 2012-10-08 mm

Moved carbons <received/> and <sent/> flags from being a sibling of <forwarded/> to being a parent of <forwarded/>, in compliance with XEP-0297.

0.6 2012-01-06 mm

Moved carbons flags from being a child of <forwarded/> to being a sibling of <forwarded/>; updating business rules regarding the <gone/> chat state.

0.5 2011-10-31 mm

Fixed more typos in examples; clarified that each resource only receives one copy of the message (forked or wrapped)

0.4 2011-08-29 mm

Fixed typos in examples.

0.3 2011-07-11 mm

Required the wrapping message to use the carbon user's bare JID; added to the security concerns about rejecting carbon copies not from the carbon user's bare JID.

0.2 2011-07-10 mm

Changed enabling and disabling to use separate elements rather than attributes; ensured all elements in the examples have their namespaces more explicitly defined; used message forwarding for carbon copies.

0.1 2010-05-03 psa

Initial published version.

0.0.2 2010-04-21 jjh

Updated after further analysis of edge cases.

0.0.1 2010-02-25 jjh

First draft.

At the time of original writing of this XEP, many XMPP servers handle message stanzas sent to a user@host (or "bare") JID with no resource by delivering that message only to the resource with the highest priority for the target user. Some server implementations, however, have chosen to send these messages to all of the online resources for the target user. If the target user is online with multiple resources when the original message is sent, a conversation ensues on one of the user's devices; if the user subsequently switches devices, parts of the conversation may end up on the alternate device, causing the user to be confused, misled, or annoyed.

This XEP defines an approach for ensuring that all of my devices get both sides of all conversations in order to avoid user confusion. As a pleasant side-effect, information about the current state of a conversation is shared between all of a user's clients that implement this protocol.

An entity advertises support for this protocol by including the "urn:xmpp:carbons:2" feature in its service discovery information features as specified in &xep0030; or section 6.3 of &xep0115;.

]]> ... ... ]]>

When a client wants to participate in the Carbons protocol, it enables the protocol by sending an IQ-set containing a child element <enable/> qualified by the namespace "urn:xmpp:carbons:2":

]]>

The server will respond with an IQ-result when Carbons are enabled:

]]>

If the server cannot enable Carbons for this client, it sends an IQ-error to the client, with an appropriate error condition (e.g., <forbidden/> if local policy forbids the client from enabling):

]]>

There are various reasons why a server might not be able to enable Carbons for a client. The RECOMMENDED error conditions to return for some reasons are:

  • <forbidden/> if the server's policy forbids the client from enabling Carbons.
  • <not-allowed/> if the request is from a client that is not hosted on this server.

See the section Handling Multiple Enable/Disable Requests for considerations when a client attempts to enable Carbons multiple times.

Some clients might want to disable Carbons. To disable Carbons, the client sends an IQ-set containing a child element <disable/> qualified by the namespace "urn:xmpp:carbons:2":

]]>

The server will respond with an IQ-result when Carbons are disabled:

]]>

If the server cannot disable Carbons for this client, it sends an IQ-error to the client, with an appropriate error condition (e.g., <not-allowed/> if trying to disable another client's Carbons):

]]>

There are various reasons why a server might not be able to disable Carbons for a client. The RECOMMENDED error conditions to return for some reasons are:

  • <not-allowed/> if the request is from a client that is not hosted on this server.

See the section Handling Multiple Enable/Disable Requests for considerations when a client attempts to disable Carbons multiple times.

The focus of this specification is instant messaging applications and so those (and only those) &MESSAGE; stanzas used for instant messaging SHOULD be delivered as Carbons.

The following is the set of rules that a server implementation SHOULD use to determine which messages should be carbon-copied. Future specifications MAY add or override rules, though they are generally advised to use the <private/> element.

A &MESSAGE; is eligible for carbons delivery if it does not contain a <private/> child element and if at least one of the following is true:

  • it is of type "chat".
  • it is of type "normal" and contains a <body> element.
  • it contains payload elements typically used in IM (&xep0184;, &xep0085;, &xep0333;).
  • it is of type "error" and it was sent in response to a &MESSAGE; that was eligible for carbons delivery.
  • it matches the MUC-related rules outlined below.

To properly handle messages exchanged with a MUC (or similar service), the server must be able to identify MUC-related messages. This can be accomplished by tracking the clients' presence in MUCs, or by checking for the <x xmlns="http://jabber.org/protocol/muc#user"> element in messages. The following rules apply to MUC-related messages:

  • A &MESSAGE; of type "groupchat" SHOULD NOT be carbon-copied.
  • A &MESSAGE; containing a &xep0249; SHOULD be carbon-copied.
  • A &MESSAGE; containing a Mediated Invitation SHOULD be carbon-copied.
  • A private &MESSAGE; from a local user to a MUC participant (sent to a full JID) SHOULD be carbon-copiedThe server SHOULD limit carbon-copying to the clients sharing a Multi-Session Nick in that MUC, and MAY inject the <x/> element into such carbon copies. Clients can not respond to carbon-copies of MUC-PMs related to a MUC they are not joined to. Therefore, they SHOULD either ignore such carbon copies, or provide a way for the user to join the MUC before answering..
  • A private &MESSAGE; from a MUC participant (received from a full JID) to a local user SHOULD NOT be carbon-copied (these messages are already replicated by the MUC service to all joined client instances).

As the above is an implementation detail of servers, clients MUST NOT rely on the server implementing a particular set of rules for which messages are eligible for Carbons delivery.

Future specifications may have more precise requirements on which messages need to be eligible for carbons delivery; such future specifications will provide their own discovery and negotiation mechanisms, such that a client negotiating Carbons using the protocol defined in this specification will cause the server to consider messages eligible for Carbons delivery based on the requirements described herein.

Note: previous versions of this specification limited eligible messages to those of type "chat" - however, this was generally found to be inadequate due to the proliferation of type "normal" messages used in instant messaging.

A server implementation can choose to advertise full support of all the rules in §6.1 by including the "urn:xmpp:carbons:rules:0" feature in its service discovery information. If that feature is advertised, the rules above must be treated as REQUIRED and not merely as RECOMMENDED.

Accordingly, if this feature is advertised, a client MAY rely on the server supporting this exact set of rules.

While future versions of this specification (or other specifications) might use a different set of delivery rules, they would signify this by advertising a namespace other than "urn:xmpp:carbons:rules:0".

When the server receives a &MESSAGE; eligible for carbons delivery addressed to a client JID (either bare or full), it delivers the &MESSAGE; according to RFC 6121 § 8.5.3, and then delivers a forwarded copy to each Carbons-enabled resource for the matching bare JID recipient that did not receive it under the RFC 6121 delivery rules.

Each forwarded copy is wrapped using &xep0297; with the following properties:

The receiving server MUST NOT send a forwarded copy to the client(s) the original &MESSAGE; stanza was addressed to, as these recipients receive the original &MESSAGE; stanza.

What man art thou that, thus bescreen'd in night, so stumblest on my counsel? 0e3141cd80894871a68e6fe6b1ec56fa ]]> What man art thou that, thus bescreen'd in night, so stumblest on my counsel? 0e3141cd80894871a68e6fe6b1ec56fa ]]>

A client MUST NOT accept Carbons that originate from a different JID than the own account (See Security Considerations).

Thou shall meet me tonite, at our house's hall! ]]>

When a client sends a &MESSAGE; eligible for carbons delivery, its sending server delivers the &MESSAGE; according to RFC 6120 and RFC 6121, and delivers a forwarded copy to each Carbons-enabled resource for the matching bare JID sender, excluding the sending client. Note that this happens irrespective of whether the sending client has carbons enabled.

Each forwarded copy is wrapped using &xep0297; with the following properties:

The sending server SHOULD NOT send a forwarded copy to the sending full JID if it is a Carbons-enabled resource.

Neither, fair saint, if either thee dislike. 0e3141cd80894871a68e6fe6b1ec56fa ]]> Neither, fair saint, if either thee dislike. 0e3141cd80894871a68e6fe6b1ec56fa ]]>

Some clients might want to avoid Carbons on a single message, while still keeping all of the other semantics of Carbon support. This might be useful for clients sending end-to-end encrypted messages.

Interoperability note: earlier versions of this XEP required or recommended the removal of the <private/> element (albeit not of the <no-copy/> hint) by one of the involved servers, but this behavior was considered as a potential security issue as the sender could silently manipulate the delivery of messages, so that the requirement was lifted. However, clients MUST NOT assume that a message without the element was actually routed to all other resources of the account.

Note: Use of the private mechanism might lead to partial conversations on other devices. This is the intended effect. If the private &MESSAGE; stanza is addressed to a bare JID, the receiving server still delivers it according to RFC 6121. This might result in a copy being delivered to each resource for the recipient, which effectively negates the behavior of the <private/> element for recipients.

Neither, fair saint, if either thee dislike. 0e3141cd80894871a68e6fe6b1ec56fa ]]> Neither, fair saint, if either thee dislike. 0e3141cd80894871a68e6fe6b1ec56fa ]]>

Handling multiple enable/disable request must adhere to the following rules:

  • If a client is permitted to enable Carbons during its login session, the server MUST allow the client to enable and disable the protocol multiple times within a session.
  • The server SHOULD NOT treat multiple enable requests (without an intermediate disable request) as an error;
  • the server SHOULD simply return an IQ-result (if the protocol is already enabled) or an IQ-error (if the client is not permitted to enable Carbons) for any subsequent requests after the first.
  • Similarly, the server SHOULD NOT treat multiple disable requests (without an intermediate enable request) as an error;
  • the server SHOULD return an IQ-result (if the protocols is already disabled) or an IQ-error (if the client's request failed previously) for any subsequent requests after the first.

Note: &xep0085; recommends sending chat state notifications as chat type messages, which means that they will be subject to Carbon-copying. This is intentional.

Additionally, there are other considerations for clients that implement Carbons and XEP-0085:

  • Upon receiving an inbound or outbound <gone/> chat state (as a carbon copy) for a given conversation, the client SHOULD visually indicate the conversation is terminated.
  • In order to prevent unwanted termination of conversations on other resources, clients SHOULD NOT send <gone/> chat states on logout, instead
  • clients SHOULD count on the broadcast of unavailable presence to convey the change in attention.
  • Upon receiving an outbound notification of any chat state other than <gone/>, the copied client MAY conclude that the sending client has taken responsibility for the conversation, and make appropriate user interface modifications. For example, notifications could be suppressed on devices receiving the Carbon copies.

The following rules prevent some of the half-failure modes that have been an issue in other protocols:

  • When a server attempts to deliver a (locally generated) carbon copy, and that carbon copy bounces with an error for any reason, the server MUST NOT forward that error back to the original sender.
  • The server MUST NOT rely on the <sent/> or <received/> elements in the bounce to determine that an error is from a carbon-copied message, because entities are not required to include the original XML in their error replies as per RFC 6120, §8.3.1.

Clients that automatically respond to messages for any reason (e.g., when in the "dnd" presence show state) MUST take adequate care when enabling Carbons in order to prevent storms or loops.

Forwarded outbound messages MUST NOT be auto-replied to under any circumstances.

Forwarded inbound messages MUST NOT be auto-replied to unless the client has some way of ensuring no more than one auto-reply is sent from all of its user's resources.

Mobile clients are often connected to the server in parallel to another (desktop) client. Therefore, it is highly recommended for mobile clients to implement this protocol to receive all live traffic, and to generally follow the Mobile Compliance Suite recommendations.

The security model assumed by this document is that all of the resources for a single user are in the same trust boundary.

Outbound chat messages that are encrypted end-to-end are not often useful to receive on other resources. As such, they should use the <private/> element specified above to avoid such copying, unless the encryption mechanism is able to accommodate this protocol.

Multiple XMPP Clients User Impersonation Vulnerability Multiple Vulnerabilities found in Dino Missing sender verification for Carbons and MAM in Monal before 4.9

This document requires no interaction with &IANA;.

This specification defines the following XML namespace:

  • urn:xmpp:carbons:2

Upon advancement of this specification from a status of Experimental to a status of Draft, the ®ISTRAR; shall add the foregoing namespace to the registry located at &NAMESPACES;, as described in Section 4 of &xep0053;.

&NSVER;
]]>

The authors wish to thank Patrick Barry, Teh Chang, Jack Erwin, Craig Kaes, Kathleen McMurry, Tory Patnoe, Peter Saint-Andre, Ben Schumacher, and Kevin Smith for their feedback.