Skip to content

Commit 023c112

Browse files
domenicannevk
authored andcommitted
Fix and clarify some [CEReactions] annotations
Closes #3887, for nonce="". Closes #3889, for textarea's value="".
1 parent ea3cde3 commit 023c112

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

source

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7117,6 +7117,15 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
71177117
value of this element's <span>[[CryptographicNonce]]</span>; and on setting, set this element's
71187118
<span>[[CryptographicNonce]]</span> to the given value.</p>
71197119

7120+
<p class="note" id="nonce-does-not-update-dom">Note how the setter for the <code
7121+
data-x="dom-HTMLOrSVGElement-nonce">nonce</code> IDL attribute does not update the corresponding
7122+
content attribute. This, as well as the below setting of the <code
7123+
data-x="attr-nonce">nonce</code> content attribute to the empty string when an element
7124+
<span>becomes browsing-context connected</span>, is meant to prevent exfiltration of the nonce
7125+
value through mechanisms that can easily read content attributes, such as selectors. Learn more in
7126+
<a href="https://github.com/whatwg/html/issues/2369">issue #2369</a>, where this behavior was
7127+
introduced.</p>
7128+
71207129
<p>Whenever an element including <code>HTMLOrSVGElement</code> has its <code
71217130
data-x="attr-nonce">nonce</code> attribute is set or changed, set this element's
71227131
<span>[[CryptographicNonce]]</span> to the given value.</p>
@@ -10236,7 +10245,7 @@ interface <dfn>HTMLUnknownElement</dfn> : <span>HTMLElement</span> { };</code></
1023610245

1023710246
<pre><code class="idl" data-x="">interface mixin <dfn>HTMLOrSVGElement</dfn> {
1023810247
[SameObject] readonly attribute <span>DOMStringMap</span> <span data-x="dom-dataset">dataset</span>;
10239-
attribute DOMString <span data-x="dom-HTMLOrSVGElement-nonce">nonce</span>;
10248+
attribute DOMString <span data-x="dom-HTMLOrSVGElement-nonce">nonce</span>; // <a href="#nonce-does-not-update-dom">intentionally no [CEReactions]</a>
1024010249

1024110250
[<span>CEReactions</span>] attribute long <span data-x="dom-tabindex">tabIndex</span>;
1024210251
void <span data-x="dom-focus">focus</span>(optional <span>FocusOptions</span> options);
@@ -50828,7 +50837,7 @@ interface <dfn>HTMLTextAreaElement</dfn> : <span>HTMLElement</span> {
5082850837

5082950838
readonly attribute DOMString <span data-x="dom-textarea-type">type</span>;
5083050839
[<span>CEReactions</span>] attribute DOMString <span data-x="dom-textarea-defaultValue">defaultValue</span>;
50831-
[<span>CEReactions</span>] attribute [TreatNullAs=EmptyString] DOMString <span data-x="dom-textarea-value">value</span>;
50840+
attribute [TreatNullAs=EmptyString] DOMString <span data-x="dom-textarea-value">value</span>;
5083250841
readonly attribute unsigned long <span data-x="dom-textarea-textLength">textLength</span>;
5083350842

5083450843
readonly attribute boolean <span data-x="dom-cva-willValidate">willValidate</span>;

0 commit comments

Comments
 (0)