XEP-0424: Message Retraction

Abstract
This specification defines a method for indicating that a message should be retracted.
Authors
  • Lance Stout
  • JC Brand
Copyright
© 1999 – 2021 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Proposed

NOTICE: This document is currently within Last Call or under consideration by the XMPP Council for advancement to the next stage in the XSF standards process. The Last Call ends on 2022-01-04. Please send your feedback to the standards@xmpp.org discussion list.
Type
Standards Track
Version
0.4.0 (2023-02-19)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

A chat participant might want to retract a message which they've already sent out, for example if they've mistakenly sent it to the wrong recipient or groupchat.

Due to the federated and extensible nature of XMPP it's not possible to remove a message with full certainty and a retraction can only be considered an unenforceable request for such removal. Clients which don't support message retraction are not obligated to enforce the request and people could have seen or copied the message contents already.

2. Discovering support

If a client implements message retractions, it MUST specify the 'urn:xmpp:message-retract:1' feature in its service discovery information features as specified in Service Discovery (XEP-0030) [1] and the Entity Capabilities profile specified in Entity Capabilities (XEP-0115) [2].

Similarly, a server that is aware of message retractions and will therefore ensure that they're archived for later retrieval (e.g.via Message Archive Management (XEP-0313) [3]), MUST also advertise the 'urn:xmpp:message-retract:1' feature.

Example 1. Client requests information about a chat partner's client
<iq type='get'
    from='romeo@montague.example/orchard'
    to='juliet@capulet.example/balcony'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
Example 2. Partner's client advertises support for retraction
<iq type='result'
    to='romeo@montague.example/orchard'
    from='juliet@capulet.example/balcony'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
...
    <feature var='urn:xmpp:message-retract:1'/>
...
  </query>
</iq>

3. Use Case

Consider a situation where a user sends a message to the wrong recipient:

Example 3. The user's client sends a message to the wrong recipient
<message type='chat' to='lord@capulet.example' id='wrong-recipient-1'>
  <body>Have not saints lips, and holy palmers too?</body>
  <origin-id xmlns='urn:xmpp:sid:0' id='origin-id-1'/>
</message>

The message author notices that the message was sent to the wrong recipient and indicates to their client that the message should be retracted.

The client sends out a retraction message and uses the Unique and Stable Stanza IDs (XEP-0359) [4] origin ID to refer to the original message that should be removed.

In the case of a group chat message, for example Multi-User Chat (XEP-0045) [5], instead of the origin ID, the XEP-0359 stanza ID that was assigned by the group chat SHOULD be used.

Example 4. The client sends out a retraction message
<message type='chat' to='lord@capulet.example' id='retract-message-1'>
  <retract id="origin-id-1" xmlns='urn:xmpp:message-retract:1'/>
  <fallback xmlns="urn:xmpp:fallback:0"/>
  <body>This person attempted to retract a previous message, but it's unsupported by your client.</body>
  <store xmlns="urn:xmpp:hints"/>
</message>

It's RECOMMENDED that you include a Fallback Indication (XEP-0428) [6] tag with fallback text in the <body/>, so that older clients can still indicate the intent to retract and so that older servers will archive the retraction. Additionally, you MAY include a Message Processing Hints (XEP-0334) [7] <store/> hint, to indicate that the stanza needs to be archived.

4. Tombstones

It might be desirable to remove the retracted message from a Message Archive Management (XEP-0313) [3] service, while still recording the fact that it once existed, in order to aid clients in synchronizing their archives. To do this, the archiving service MAY replace the retracted message contents with a 'tombstone'.

A service which supports tombstones MUST advertise the 'urn:xmpp:message-retract:1#tombstone' feature in its Service Discovery responses.

Example 5. Client requests service discovery information from the server
<iq type='get'
    from='romeo@montague.example/orchard'
    to='romeo@montague.example'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
Example 6. The server advertises support for tombstone retraction
<iq type='result'
    to='romeo@montague.example/orchard'
    from='romeo@montague.example'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
...
    <feature var='urn:xmpp:message-retract:1#tombstone'/>
...
  </query>
</iq>

When replacing the original message with a tombstone, the original contents (i.e. the <body/> and any related elements which might leak information about the original message) get replaced with a <retracted/> element which MUST include an 'id' attribute referring to the original message as detailed in the section on using the correct ID, so that clients can match it to the subsequent retraction (which MUST also be stored in the archive).

The <retracted/> element SHOULD also include a 'stamp' attribute indicating the time at which the retraction took place.

As with other XEP-0313 archived messages, the Delayed Delivery (XEP-0203) [8] <delay/> element is used to indicate when the original message was received.

Example 7. Retracted message tombstone in a MAM result
<message id='aeb213' to='lord@capulet.example/chamber'>
  <result xmlns='urn:xmpp:mam:2' queryid='f27' id='stanza-id-1'>
    <forwarded xmlns='urn:xmpp:forward:0'>
      <delay xmlns='urn:xmpp:delay' stamp='2019-09-20T23:08:25Z'/>
      <message type="groupchat" from="romeo@montague.example" to="lord@capulet.example" id="wrong-recipient-1">
        <retracted stamp='2019-09-20T23:09:32Z' xmlns='urn:xmpp:message-retract:1' id='origin-id-1'/>
      </message>
  </forwarded>
</result>
</message>

5. Business Rules

A receiving client can choose to remove the retracted message from whatever display is used for messages, from any stored history, or choose to display the fact that a message has been retracted in another way.

A MUC or other service that supports message retraction SHOULD prevent further distribution of the message by the service (e.g., by not replaying the message to new occupants joining the room, omitting the message from history archive requests where possible, or replacing the original message with a 'tombstone').

Some clients may have been offline while the retraction was issued. The archiving service therefore MUST store the retraction message, regardless of whether the original message is deleted or replaced with a tombstone. These clients will then become aware of the retraction as soon as they catch up with the archive.

A client MAY inform the user that a no-longer displayed message did previously exist and has been removed.

Clients SHOULD add the Unique and Stable Stanza IDs (XEP-0359) [4] <origin-id> on sent one-on-one "chat" messages to make them suitable for message retraction.

The Sender MUST NOT send a retraction request for a message with non-messaging payloads. For example, a sender MUST NOT send a retraction for a roster item exchange request or a file transfer part.

A retraction (that's not part of a Message Moderation (XEP-0425) [9] operation) MUST only be processed when both the original message and the retraction request are received from the same bare-JID (in a one-on-one conversation) or full-JID (in a non-anonymous MUC from Multi-User Chat (XEP-0045) [5]).

When used in a semi-anonymous MUC, the recipient client MUST check that a message retraction was sent by the author of the retracted message by checking the occupant id from Anonymous unique occupant identifiers for MUCs (XEP-0421) [10].

5.1 Using the correct ID

For messages of type 'groupchat', the stanza's Unique and Stable Stanza IDs (XEP-0359) [4] 'origin ID' MUST NOT be used for retractions. Instead, in group chat situations, the ID assigned to the stanza by the group chat itself must be used. This is discovered in a <stanza-id> element with a 'by' attribute that matches the bare JID of the group chat, as defined in Unique and Stable Stanza IDs (XEP-0359) [4].

This implies that group chat messages without a Unique and Stable Stanza IDs (XEP-0359) [4] stanza ID cannot be retracted.

For other message types the sender should use the 'id' from a Unique and Stable Stanza IDs (XEP-0359) [4] <origin-id> if present, or the value of the 'id' attribute on the <message> otherwise.

6. Security Considerations

There can never be a guarantee that a retracted message was never seen or otherwise distributed, and it is encouraged for clients and services when possible to inform users that no such guarantee exists.

To prevent message spoofing, it's very important that the JID or occupant id of message retractions are checked (as explained in the Business Rules section).

7. IANA Considerations

None.

8. XMPP Registrar Considerations

8.1 Protocol Namespaces

The XMPP Registrar [11] includes 'urn:xmpp:message-retract:1' in its registry of protocol namespaces (see <https://xmpp.org/registrar/namespaces.html>).

8.2 Protocol Versioning

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.

9. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:message-retract:1'
    xmlns='urn:xmpp:message-retract:1'
    elementFormDefault='qualified'>

  <xs:element name='retract'>
    <xs:attribute name='id' type='xs:string' use='required'/>
  </xs:element>

  <xs:element name='retracted'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='xs:string'>
          <xs:attribute name='by' type='xs:string' use='required'/>
          <xs:attribute name='from' type='xs:string' use='optional'/>
          <xs:attribute name='stamp' type='xs:dateTime' use='required'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

</xs:schema>
    

Appendices

Appendix A: Document Information

Series
XEP
Number
0424
Publisher
XMPP Standards Foundation
Status
Proposed
Type
Standards Track
Version
0.4.0
Last Updated
2023-02-19
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM, XEP-0313, XEP-0421
Supersedes
None
Superseded By
None
Short Name
message-retract
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Lance Stout
Email
lance@andyet.com
JabberID
lance@lance.im
JC Brand
Email
jc@opkode.com
JabberID
jc@opkode.com

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 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. ##

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

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 <https://xmpp.org/community/> 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-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

2. XEP-0115: Entity Capabilities <https://xmpp.org/extensions/xep-0115.html>.

3. XEP-0313: Message Archive Management <https://xmpp.org/extensions/xep-0313.html>.

4. XEP-0359: Unique and Stable Stanza IDs <https://xmpp.org/extensions/xep-0359.html>.

5. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

6. XEP-0428: Fallback Indication <https://xmpp.org/extensions/xep-0428.html>.

7. XEP-0334: Message Processing Hints <https://xmpp.org/extensions/xep-0334.html>.

8. XEP-0203: Delayed Delivery <https://xmpp.org/extensions/xep-0203.html>.

9. XEP-0425: Message Moderation <https://xmpp.org/extensions/xep-0425.html>.

10. XEP-0421: Anonymous unique occupant identifiers for MUCs <https://xmpp.org/extensions/xep-0421.html>.

11. 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/>.

Appendix H: Revision History

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

  1. Version 0.4.0 (2023-02-19)
    jcb
  2. Version 0.3.0 (2020-05-17)
    jcb
  3. Version 0.2.1 (2020-03-25)
    Recommend XEP-0428 fallback body and XEP-0334 store hint
    jcb
  4. Version 0.2.0 (2019-11-11)
    Replace the message contents with a tombstone (instead of the message itself) and require an origin-id in tombstone
    jcb
  5. Version 0.1.0 (2019-11-01)
    Accepted by vote of Council on 2019-10-23.
    XEP Editor (jcb)
  6. Version 0.0.4 (2019-09-25)

    Remove MUC moderation use-case which will go into a separate XEP

    jcb
  7. Version 0.0.3 (2016-10-19)

    Fix the XEP title to be Message Retraction.

    ljts
  8. Version 0.0.2 (2016-10-12)

    Use the term 'retraction' instead of 'deletion'. Added tombstone marker.

    ljts
  9. Version 0.0.1 (2015-07-07)

    First draft.

    ljts

Appendix I: Bib(La)TeX Entry

@report{stout2015message-retract,
  title = {Message Retraction},
  author = {Stout, Lance and Brand, JC},
  type = {XEP},
  number = {0424},
  version = {0.4.0},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0424.html},
  date = {2015-07-07/2023-02-19},
}

END