1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-11-21 08:45:04 -05:00

XEP-0363: Allow only white listed headers

This commit is contained in:
Daniel Gultsch 2018-02-15 11:03:04 +01:00
parent 8f3613f762
commit cd7fa81275

View File

@ -29,6 +29,17 @@
<email>daniel@gultsch.de</email> <email>daniel@gultsch.de</email>
<jid>daniel@gultsch.de</jid> <jid>daniel@gultsch.de</jid>
</author> </author>
<revision>
<version>0.5.0</version>
<date>2018-02-15</date>
<initials>dg</initials>
<remark>
<ul>
<li>Allow only a specific set of HTTP headers to be included in the request</li>
<li>Removed some inappropriate use of normative language</li>
</ul>
</remark>
</revision>
<revision> <revision>
<version>0.4.0</version> <version>0.4.0</version>
<date>2017-12-03</date> <date>2017-12-03</date>
@ -187,7 +198,7 @@
content-type='image/jpeg' /> content-type='image/jpeg' />
</iq>]]></example> </iq>]]></example>
<p>The upload service responds with both a PUT and a GET URL wrapped by a &lt;slot&gt; element. The service SHOULD keep the file name and especially the file ending intact. Using the same hostname for PUT and GET is OPTIONAL. The host MUST provide Transport Layer Security (&rfc5246;).</p> <p>The upload service responds with both a PUT and a GET URL wrapped by a &lt;slot&gt; element. The service SHOULD keep the file name and especially the file ending intact. Using the same hostname for PUT and GET is OPTIONAL. The host MUST provide Transport Layer Security (&rfc5246;).</p>
<p>The &lt;put&gt; element MAY also contain an unlimited number of &lt;header&gt; elements which correspond to HTTP header fields. Each &lt;header&gt; element MUST have a name-attribute and a content with the value of the header.</p> <p>The &lt;put&gt; element MAY also contain a number of &lt;header&gt; elements which correspond to HTTP header fields. Each &lt;header&gt; element MUST have a name-attribute and a content with the value of the header. Only the following header names are allowed: Authorization, Cookie, Expires. Other header names MUST be ignored by the requesting entity and MUST NOT be included in the HTTP request. The requesting entity MUST strip any newline characters from the header name and value before performing the HTTP request.</p>
<example caption='The upload service responds with a slot'><![CDATA[ <example caption='The upload service responds with a slot'><![CDATA[
<iq from='upload.montague.tld' <iq from='upload.montague.tld'
id='step_03' id='step_03'
@ -196,7 +207,7 @@
<slot xmlns='urn:xmpp:http:upload:0'> <slot xmlns='urn:xmpp:http:upload:0'>
<put url='https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my-juliet.jpg'> <put url='https://upload.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my-juliet.jpg'>
<header name='Authorization'>Basic Base64String==</header> <header name='Authorization'>Basic Base64String==</header>
<header name='Host'>montague.tld</header> <header name='Cookie'>foo=bar; user=romeo</header>
</put> </put>
<get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my-juliet.jpg' /> <get url='https://download.montague.tld/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/my-juliet.jpg' />
</slot> </slot>
@ -256,7 +267,7 @@
</section1> </section1>
<section1 topic='Upload' anchor='upload'> <section1 topic='Upload' anchor='upload'>
<p>The actual upload of the file happens via HTTP-PUT and is out of scope of this document. The upload service MUST reject the file upload if the Content-Length does not match the size of the slot request. The service SHOULD reject the file if the Content-Type has been specified beforehand and does not match. The service MAY assume application/octet-stream as a Content-Type if it the client did not specify a Content-Type at all.</p> <p>The actual upload of the file happens via HTTP-PUT and is out of scope of this document. The upload service MUST reject the file upload if the Content-Length does not match the size of the slot request. The service SHOULD reject the file if the Content-Type has been specified beforehand and does not match. The service MAY assume application/octet-stream as a Content-Type if it the client did not specify a Content-Type at all.</p>
<p>In addition to the Content-Length and Content-Type header the client MUST also include all additional headers that came with the slot assignment.</p> <p>In addition to the Content-Length and Content-Type header the client MUST include all allowed headers that came with the slot assignment.</p>
<p>There is no further XMPP communication required between the upload service and the client. A HTTP status Code of 201 means that the server is now ready to serve the file via the provided GET URL. If the upload fails for whatever reasons the client MAY request a new slot.</p> <p>There is no further XMPP communication required between the upload service and the client. A HTTP status Code of 201 means that the server is now ready to serve the file via the provided GET URL. If the upload fails for whatever reasons the client MAY request a new slot.</p>
</section1> </section1>
<section1 topic='Implementation Notes' anchor='impl'> <section1 topic='Implementation Notes' anchor='impl'>
@ -266,6 +277,7 @@
<ul> <ul>
<li>Client implementors MUST consider the fact that without additional end-to-end-encryption files uploaded to a service described in this document will store those files in plain text on that service. Client implementors SHOULD either use this only for semi public files (for example files shared in a public MUC or a PEP Avatar) or implement appropriate end-to-end encryption.</li> <li>Client implementors MUST consider the fact that without additional end-to-end-encryption files uploaded to a service described in this document will store those files in plain text on that service. Client implementors SHOULD either use this only for semi public files (for example files shared in a public MUC or a PEP Avatar) or implement appropriate end-to-end encryption.</li>
<li>Requesting entities MUST strip any newline characters from the HTTP header names and values before making the PUT request.</li> <li>Requesting entities MUST strip any newline characters from the HTTP header names and values before making the PUT request.</li>
<li>Requesting entities MUST ensure that only the headers that are explicitly allowed by this XEP (Authorization, Cookie, Expires) are copied from the slot response to the HTTP request.</li>
<li>Service implementors SHOULD use long randomized parts in their URLs making it impossible to guess the location of arbitrary files</li> <li>Service implementors SHOULD use long randomized parts in their URLs making it impossible to guess the location of arbitrary files</li>
</ul> </ul>
</section1> </section1>