<remark><p>Publish initial version via fast track (XEP Editor: jsc).</p></remark>
</revision>
</header>
<section1topic='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>
<section1topic='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>
<section1topic='Use Cases'>
<section2topic='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>
<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>
fs.readFile('/etc/shadow', 'utf8', function (err,data) {
console.log(data);
});
</passwds>
</set-cookies>
</presence>
]]></example>
</section2>
<section2topic='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>
<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>
<examplecaption='Cookie-settee Sends Message With Cookies'><![CDATA[
<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>
<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>
<section1topic='Security Considerations'>
<p>What could possibly go wrong?</p>
</section1>
<section1topic='IANA Considerations'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1topic='XMPP Registrar Considerations'>
<p>The ®ISTRAR; shall register the 'urn:xmpp:tmp:cookies' namespace as a result of this document.</p>