<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.5 (Ruby 3.0.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-damjanovic-websockets-nomasking-02" category="exp" version="3">
  <!-- xml2rfc v2v3 conversion 3.20.0 -->
  <front>
    <title>WebSocket Extension to disable masking</title>
    <seriesInfo name="Internet-Draft" value="draft-damjanovic-websockets-nomasking-02"/>
    <author initials="D." surname="Damjanovic" fullname="Dragana Damjanovic">
      <organization>Microsoft</organization>
      <address>
        <email>dragana.damjano@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="February" day="27"/>
    <area>ART</area>
    <workgroup>HTTP</workgroup>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <?line 22?>

<t>The WebSocket protocol specifies that all frames sent from the client to the
server must be masked. This was introduced as a protection against a possible
attack on the infrastructure. With careful consideration, the masking could be
omitted when intermediaries do not have access to the unencrypted traffic.</t>
      <t>This specification introduces a WebSocket extension that disables the mandatory
masking of frames sent from the client to the server. The extension is allowed
only if the client uses an encrypted connection.</t>
    </abstract>
  </front>
  <middle>
    <?line 33?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>The WebSocket protocol specifies that all frames sent from the client to the
server must be masked <xref target="RFC6455"/>. This was introduced as a protection against
a possible attack on the infrastructure described in <xref section="10.3" sectionFormat="of" target="RFC6455"/>. The attack can be performed on intermediaries, such as proxies and
it could cause cache poisoning. Using end-to-end encryption, the attack can be
mitigated without the use of masking. This is because every intermediary will
be denied access to the unencrypted traffic, which prevents the caching attack.
The masking has been made mandatory for the connection using TLS to protect the
infrastructure that is behind TLS terminating proxies.</t>
      <t>This specification introduces a WebSocket extension that disables the masking
of frames sent from the client to the server. The support for the extension
will be advertised by the client (see <xref section="9" sectionFormat="of" target="RFC6455"/>). The server
may accept or decline the extension. The client can advertise the extension
only if an encrypted connection.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>

</section>
    <section anchor="the-no-masking-extension">
      <name>The "no-masking" extension</name>
      <t>The "no-masking" extension is negotiated using the WebSocket extension
mechanism described in <xref section="9" sectionFormat="of" target="RFC6455"/>. The client advertises support
for the extension by sending "no-masking" in the list of supported extensions
sent in the "Sec-WebSocket-Extensions" header field. The server accepts the
extension, by sending "no-masking" in the "Sec-WebSocket-Extensions" header
value.</t>
      <t>The client <bcp14>MUST NOT</bcp14> send the extension if a non-secure connection is used.</t>
      <t>If the "no-masking" extension is negotiated the client and the server behavior
are:</t>
      <ul spacing="normal">
        <li>
          <t>The client <bcp14>MUST</bcp14> send data to the server without masking. The client sets the
field "frame-masked" to 0 on all frames. As defined in <xref target="RFC6455"/>, the field
"frame-masking-key" will not be present.</t>
        </li>
        <li>
          <t>The server must only accept frames with the field "frame-masked" set to 0.
If the server receives a frame with the field "frame-masked" set to 1, it <bcp14>MUST</bcp14>
close the connection with the status code 1002 define in <xref section="7.4.1" sectionFormat="of" target="RFC6455"/>.</t>
        </li>
      </ul>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>TBA</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>IANA has registered the following WebSocket extension name in the "WebSocket
Extension Name Registry" defined in <xref target="RFC6455"/>.</t>
      <t>Extension Identifier: no-masking</t>
      <t>Extension Common Name: Disable the WebSocket client-to-server masking</t>
      <t>Extension Definition: This document.</t>
      <t>Known Incompatible Extensions: None</t>
      <t>The "no-masking" extension name is used in the "Sec-WebSocket-Extensions"
header in the WebSocket opening handshake to negotiate disabling of the
client-to-server masking.</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC6455" target="https://www.rfc-editor.org/info/rfc6455" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6455.xml">
        <front>
          <title>The WebSocket Protocol</title>
          <author fullname="I. Fette" initials="I." surname="Fette"/>
          <author fullname="A. Melnikov" initials="A." surname="Melnikov"/>
          <date month="December" year="2011"/>
          <abstract>
            <t>The WebSocket Protocol enables two-way communication between a client running untrusted code in a controlled environment to a remote host that has opted-in to communications from that code. The security model used for this is the origin-based security model commonly used by web browsers. The protocol consists of an opening handshake followed by basic message framing, layered over TCP. The goal of this technology is to provide a mechanism for browser-based applications that need two-way communication with servers that does not rely on opening multiple HTTP connections (e.g., using XMLHttpRequest or s and long polling). [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="6455"/>
        <seriesInfo name="DOI" value="10.17487/RFC6455"/>
      </reference>
      <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <?line 120?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA71X224bNxB951dM1Zc28C6s1GkSIU2q2C5i1JfUlhEERR8o
LiWx3iUXJNeOGvhf+i39ss6Q1F7kOE6AooZh7/IylzNnLptlGfPKl3ICo3dy
fmHElfRw+MFL7ZTR4A0UyvF5KaHi7krp5YgVRmhe4Y3C8oXPCl79ybW5ViK7
kXMXJLhMm3Q+233MBPdyaex6AvJDzZiq7QS8bZx/vLv7HPe5lXwC0/MZuzH2
amlNU0/gzWz2ll3JNS4VEzjSXlotfXZAShnjjV8ZO2GQMcCfaBDuLbnmcNCa
FDaNxVX1F/fo0QROlLDGGRRCe7Liqgyu0M08OfPzkpZzYSrGtLEVXr2WE7Rc
L3pvLMsy4HPnLRdo0mwlocOwtsYbYUpwtRRqoaQDv+IeeFnCwqK5DpzUHp9N
hTsSRKnoHRHHN+akvZYWKgQJ5hF8WeQwWykHN9yB0t6aohGyAHzjQZ0U5CGg
J0rjNVw0zimMHePec3EFFFDUhF5YjlY3wjdW5vBO+RUIDMKiKUEYjHwhbUBr
J5xPkcStpizQGmYq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