Changeset 285478 in webkit
- Timestamp:
- Nov 8, 2021, 6:26:15 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r285449 r285478 1 2021-11-08 Patrick Griffis <pgriffis@igalia.com> 2 3 Implement nonce-hiding 4 https://bugs.webkit.org/show_bug.cgi?id=179728 5 6 Reviewed by Chris Dumez. 7 8 Update expectations for nonce IDL as PASSing. 9 10 * platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: 11 * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: 12 * platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt: 13 * platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: 14 * platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: 15 * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: 16 * platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt: 17 * platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt: 18 1 19 2021-11-08 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/LayoutTests/imported/w3c/ChangeLog
r285428 r285478 1 2021-11-08 Patrick Griffis <pgriffis@igalia.com> 2 3 Implement nonce-hiding 4 https://bugs.webkit.org/show_bug.cgi?id=179728 5 6 Reviewed by Chris Dumez. 7 8 Update all nonce-hiding expectations as passing. 9 Update reflection-misc as script.nonce not being reflected, this matches Chromiums results. 10 11 * web-platform-tests/content-security-policy/nonce-hiding/nonces-expected.txt: 12 * web-platform-tests/content-security-policy/nonce-hiding/script-nonces-hidden-expected.txt: 13 * web-platform-tests/content-security-policy/nonce-hiding/script-nonces-hidden-meta.sub-expected.txt: 14 * web-platform-tests/content-security-policy/nonce-hiding/svgscript-nonces-hidden-expected.txt: 15 * web-platform-tests/content-security-policy/nonce-hiding/svgscript-nonces-hidden-meta.sub-expected.txt: 16 * web-platform-tests/html/dom/idlharness.https-expected.txt: 17 * web-platform-tests/html/dom/reflection-misc-expected.txt: 18 1 19 2021-11-08 Chris Dumez <cdumez@apple.com> 2 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/nonces-expected.txt
r267651 r285478 1 1 2 FAIL Basic nonce tests for meh in HTML namespace assert_equals: Initial IDL attribute value expected (string) "" but got (undefined) undefined 3 FAIL Ensure that removal of content attribute does not affect IDL attribute for meh in HTML namespace assert_equals: IDL attribute is modified after content attribute set expected (string) "x" but got (undefined) undefined 4 FAIL Test empty nonces for meh in HTML namespace assert_equals: expected (string) "" but got (undefined) undefined 5 FAIL Basic nonce tests for div in HTML namespace assert_equals: Initial IDL attribute value expected (string) "" but got (undefined) undefined 6 FAIL Ensure that removal of content attribute does not affect IDL attribute for div in HTML namespace assert_equals: IDL attribute is modified after content attribute set expected (string) "x" but got (undefined) undefined 7 FAIL Test empty nonces for div in HTML namespace assert_equals: expected (string) "" but got (undefined) undefined 8 FAIL Basic nonce tests for script in HTML namespace assert_equals: Content attribute is changed after element insertion expected "" but got "x" 2 PASS Basic nonce tests for meh in HTML namespace 3 PASS Ensure that removal of content attribute does not affect IDL attribute for meh in HTML namespace 4 PASS Test empty nonces for meh in HTML namespace 5 PASS Basic nonce tests for div in HTML namespace 6 PASS Ensure that removal of content attribute does not affect IDL attribute for div in HTML namespace 7 PASS Test empty nonces for div in HTML namespace 8 PASS Basic nonce tests for script in HTML namespace 9 9 PASS Ensure that removal of content attribute does not affect IDL attribute for script in HTML namespace 10 10 PASS Test empty nonces for script in HTML namespace 11 FAIL Basic nonce tests for meh in SVG namespace assert_equals: Initial IDL attribute value expected (string) "" but got (undefined) undefined 12 FAIL Ensure that removal of content attribute does not affect IDL attribute for meh in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected (string) "x" but got (undefined) undefined 13 FAIL Test empty nonces for meh in SVG namespace assert_equals: expected (string) "" but got (undefined) undefined 14 FAIL Basic nonce tests for svg in SVG namespace assert_equals: Initial IDL attribute value expected (string) "" but got (undefined) undefined 15 FAIL Ensure that removal of content attribute does not affect IDL attribute for svg in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected (string) "x" but got (undefined) undefined 16 FAIL Test empty nonces for svg in SVG namespace assert_equals: expected (string) "" but got (undefined) undefined 17 FAIL Basic nonce tests for script in SVG namespace assert_equals: Initial IDL attribute value expected (string) "" but got (undefined) undefined 18 FAIL Ensure that removal of content attribute does not affect IDL attribute for script in SVG namespace assert_equals: IDL attribute is modified after content attribute set expected (string) "x" but got (undefined) undefined 19 FAIL Test empty nonces for script in SVG namespace assert_equals: expected (string) "" but got (undefined) undefined 11 PASS Basic nonce tests for meh in SVG namespace 12 PASS Ensure that removal of content attribute does not affect IDL attribute for meh in SVG namespace 13 PASS Test empty nonces for meh in SVG namespace 14 PASS Basic nonce tests for svg in SVG namespace 15 PASS Ensure that removal of content attribute does not affect IDL attribute for svg in SVG namespace 16 PASS Test empty nonces for svg in SVG namespace 17 PASS Basic nonce tests for script in SVG namespace 18 PASS Ensure that removal of content attribute does not affect IDL attribute for script in SVG namespace 19 PASS Test empty nonces for script in SVG namespace 20 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/script-nonces-hidden-expected.txt
r267651 r285478 1 1 2 FAIL Reading 'nonce' content attribute and IDL attribute. assert_equals: expected Element node <script nonce="abc" id="testScript" executed="yay"> 3 doc... but got null 4 FAIL Cloned node retains nonce. assert_equals: expected "" but got "abc" 5 FAIL Cloned node retains nonce when inserted. assert_equals: expected "" but got "abc" 2 PASS Reading 'nonce' content attribute and IDL attribute. 3 PASS Cloned node retains nonce. 4 PASS Cloned node retains nonce when inserted. 6 5 PASS Writing 'nonce' content attribute. 7 FAIL Writing 'nonce' IDL attribute. assert_equals: expected "foo" but got "bar" 6 PASS Writing 'nonce' IDL attribute. 8 7 PASS Document-written script executes. 9 FAIL Document-written script's nonce value. assert_equals: expected "" but got "abc" 10 FAIL createElement.nonce. assert_equals: expected (object) null but got (string) "abc" 11 FAIL setAttribute('nonce') overwrites '.nonce' upon insertion. assert_equals: expected "" but got "abc" 12 FAIL createElement.setAttribute. assert_equals: Post-insertion content expected "" but got "abc" 13 FAIL Custom elements expose the correct events. assert_object_equals: AttributeChanged 2 value is undefined, expected object 14 FAIL Nonces don't leak via CSS side-channels. assert_equals: expected "none" but got "url(\"http://localhost:8800/security/resources/abe.png\")" 8 PASS Document-written script's nonce value. 9 PASS createElement.nonce. 10 PASS setAttribute('nonce') overwrites '.nonce' upon insertion. 11 PASS createElement.setAttribute. 12 PASS Custom elements expose the correct events. 13 PASS Nonces don't leak via CSS side-channels. 15 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/script-nonces-hidden-meta.sub-expected.txt
r267651 r285478 4 4 PASS Cloned node retains nonce when inserted. 5 5 PASS Writing 'nonce' content attribute. 6 FAIL Writing 'nonce' IDL attribute. assert_equals: expected "foo" but got "bar" 6 PASS Writing 'nonce' IDL attribute. 7 7 PASS Document-written script executes. 8 8 PASS Document-written script's nonce value. 9 FAIL createElement.nonce. assert_equals: expected (object) null but got (string) "abc" 9 PASS createElement.nonce. 10 10 PASS setAttribute('nonce') overwrites '.nonce' upon insertion. 11 11 PASS createElement.setAttribute. -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/svgscript-nonces-hidden-expected.txt
r267651 r285478 1 1 2 2 3 FAIL Reading 'nonce' content attribute and IDL attribute. assert_equals: expected Element node <script nonce="abc" id="testScript" executed="yay"> 4 d... but got null 5 FAIL Cloned node retains nonce. assert_equals: IDL attribute expected (string) "abc" but got (undefined) undefined 6 FAIL Cloned node retains nonce when inserted. assert_equals: expected (string) "abc" but got (undefined) undefined 7 FAIL Writing 'nonce' content attribute. assert_equals: expected (string) "foo" but got (undefined) undefined 3 PASS Reading 'nonce' content attribute and IDL attribute. 4 PASS Cloned node retains nonce. 5 PASS Cloned node retains nonce when inserted. 6 PASS Writing 'nonce' content attribute. 8 7 PASS Writing 'nonce' IDL attribute. 9 8 PASS Document-written script executes. 10 FAIL Document-written script's nonce value. assert_equals: expected "" but got "abc" 11 FAIL createElement.nonce. assert_equals: expected (object) null but got (string) "abc" 12 FAIL createElement.setAttribute. assert_equals: Post-insertion content expected "" but got "abc" 9 PASS Document-written script's nonce value. 10 PASS createElement.nonce. 11 PASS createElement.setAttribute. 13 12 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/nonce-hiding/svgscript-nonces-hidden-meta.sub-expected.txt
r267651 r285478 1 1 undefined 2 2 3 FAIL Reading 'nonce' content attribute and IDL attribute. assert_equals: expected (string) "abc" but got (undefined) undefined 4 FAIL Cloned node retains nonce. assert_equals: IDL attribute expected (string) "abc" but got (undefined) undefined 5 FAIL Cloned node retains nonce when inserted. assert_equals: expected (string) "abc" but got (undefined) undefined 6 FAIL Writing 'nonce' content attribute. assert_equals: expected (string) "foo" but got (undefined) undefined 3 PASS Reading 'nonce' content attribute and IDL attribute. 4 PASS Cloned node retains nonce. 5 PASS Cloned node retains nonce when inserted. 6 PASS Writing 'nonce' content attribute. 7 7 PASS Writing 'nonce' IDL attribute. 8 8 PASS Document-written script executes. 9 FAIL Document-written script's nonce value. assert_equals: expected (string) "abc" but got (undefined) undefined 9 PASS Document-written script's nonce value. 10 10 PASS createElement.nonce. 11 11 PASS createElement.setAttribute. -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r281569 r285478 197 197 PASS HTMLElement interface: attribute inputMode 198 198 PASS HTMLElement interface: attribute dataset 199 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false199 PASS HTMLElement interface: attribute nonce 200 200 FAIL HTMLElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 201 201 PASS HTMLElement interface: attribute tabIndex … … 287 287 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 288 288 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 289 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 289 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 290 290 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type assert_inherits: property "autofocus" not found in prototype chain 291 291 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5097 5097 PASS SVGElement interface: attribute onpaste 5098 5098 PASS SVGElement interface: attribute dataset 5099 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5099 PASS SVGElement interface: attribute nonce 5100 5100 FAIL SVGElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 5101 5101 PASS SVGElement interface: attribute tabIndex -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
r284960 r285478 968 968 PASS script.nonce: setAttribute() to object "test-toString" 969 969 PASS script.nonce: setAttribute() to object "test-valueOf" 970 PASS script.nonce: IDL set to ""971 PASS script.nonce: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo"972 PASS script.nonce: IDL set to undefined 973 PASS script.nonce: IDL set to 7 974 PASS script.nonce: IDL set to 1.5 975 PASS script.nonce: IDL set to "5%"976 PASS script.nonce: IDL set to "+100"977 PASS script.nonce: IDL set to ".5"978 PASS script.nonce: IDL set to true 979 PASS script.nonce: IDL set to false 980 PASS script.nonce: IDL set to object "[object Object]"981 PASS script.nonce: IDL set to NaN 982 PASS script.nonce: IDL set to Infinity 983 PASS script.nonce: IDL set to -Infinity 984 PASS script.nonce: IDL set to "\0"985 PASS script.nonce: IDL set to null 986 PASS script.nonce: IDL set to object "test-toString"970 FAIL script.nonce: IDL set to "" assert_equals: getAttribute() expected "" but got "test-valueOf" 971 FAIL script.nonce: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " assert_equals: getAttribute() expected " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " but got "test-valueOf" 972 FAIL script.nonce: IDL set to undefined assert_equals: getAttribute() expected "undefined" but got "test-valueOf" 973 FAIL script.nonce: IDL set to 7 assert_equals: getAttribute() expected "7" but got "test-valueOf" 974 FAIL script.nonce: IDL set to 1.5 assert_equals: getAttribute() expected "1.5" but got "test-valueOf" 975 FAIL script.nonce: IDL set to "5%" assert_equals: getAttribute() expected "5%" but got "test-valueOf" 976 FAIL script.nonce: IDL set to "+100" assert_equals: getAttribute() expected "+100" but got "test-valueOf" 977 FAIL script.nonce: IDL set to ".5" assert_equals: getAttribute() expected ".5" but got "test-valueOf" 978 FAIL script.nonce: IDL set to true assert_equals: getAttribute() expected "true" but got "test-valueOf" 979 FAIL script.nonce: IDL set to false assert_equals: getAttribute() expected "false" but got "test-valueOf" 980 FAIL script.nonce: IDL set to object "[object Object]" assert_equals: getAttribute() expected "[object Object]" but got "test-valueOf" 981 FAIL script.nonce: IDL set to NaN assert_equals: getAttribute() expected "NaN" but got "test-valueOf" 982 FAIL script.nonce: IDL set to Infinity assert_equals: getAttribute() expected "Infinity" but got "test-valueOf" 983 FAIL script.nonce: IDL set to -Infinity assert_equals: getAttribute() expected "-Infinity" but got "test-valueOf" 984 FAIL script.nonce: IDL set to "\0" assert_equals: getAttribute() expected "\0" but got "test-valueOf" 985 FAIL script.nonce: IDL set to null assert_equals: getAttribute() expected "null" but got "test-valueOf" 986 FAIL script.nonce: IDL set to object "test-toString" assert_equals: getAttribute() expected "test-toString" but got "test-valueOf" 987 987 PASS script.nonce: IDL set to object "test-valueOf" 988 988 PASS script.integrity: typeof IDL attribute -
trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r285011 r285478 335 335 PASS HTMLElement interface: attribute inputMode 336 336 PASS HTMLElement interface: attribute dataset 337 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false337 PASS HTMLElement interface: attribute nonce 338 338 PASS HTMLElement interface: attribute autofocus 339 339 PASS HTMLElement interface: attribute tabIndex … … 430 430 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 431 431 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 432 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 432 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 433 433 PASS HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type 434 434 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5336 5336 PASS SVGElement interface: attribute onpaste 5337 5337 PASS SVGElement interface: attribute dataset 5338 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5338 PASS SVGElement interface: attribute nonce 5339 5339 PASS SVGElement interface: attribute autofocus 5340 5340 PASS SVGElement interface: attribute tabIndex -
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r282619 r285478 335 335 PASS HTMLElement interface: attribute inputMode 336 336 PASS HTMLElement interface: attribute dataset 337 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false337 PASS HTMLElement interface: attribute nonce 338 338 FAIL HTMLElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 339 339 PASS HTMLElement interface: attribute tabIndex … … 430 430 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 431 431 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 432 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 432 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 433 433 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type assert_inherits: property "autofocus" not found in prototype chain 434 434 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5326 5326 PASS SVGElement interface: attribute onpaste 5327 5327 PASS SVGElement interface: attribute dataset 5328 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5328 PASS SVGElement interface: attribute nonce 5329 5329 FAIL SVGElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 5330 5330 PASS SVGElement interface: attribute tabIndex -
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
r284960 r285478 968 968 PASS script.nonce: setAttribute() to object "test-toString" 969 969 PASS script.nonce: setAttribute() to object "test-valueOf" 970 PASS script.nonce: IDL set to ""971 PASS script.nonce: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo"972 PASS script.nonce: IDL set to undefined 973 PASS script.nonce: IDL set to 7 974 PASS script.nonce: IDL set to 1.5 975 PASS script.nonce: IDL set to "5%"976 PASS script.nonce: IDL set to "+100"977 PASS script.nonce: IDL set to ".5"978 PASS script.nonce: IDL set to true 979 PASS script.nonce: IDL set to false 980 PASS script.nonce: IDL set to object "[object Object]"981 PASS script.nonce: IDL set to NaN 982 PASS script.nonce: IDL set to Infinity 983 PASS script.nonce: IDL set to -Infinity 984 PASS script.nonce: IDL set to "\0"985 PASS script.nonce: IDL set to null 986 PASS script.nonce: IDL set to object "test-toString"970 FAIL script.nonce: IDL set to "" assert_equals: getAttribute() expected "" but got "test-valueOf" 971 FAIL script.nonce: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " assert_equals: getAttribute() expected " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " but got "test-valueOf" 972 FAIL script.nonce: IDL set to undefined assert_equals: getAttribute() expected "undefined" but got "test-valueOf" 973 FAIL script.nonce: IDL set to 7 assert_equals: getAttribute() expected "7" but got "test-valueOf" 974 FAIL script.nonce: IDL set to 1.5 assert_equals: getAttribute() expected "1.5" but got "test-valueOf" 975 FAIL script.nonce: IDL set to "5%" assert_equals: getAttribute() expected "5%" but got "test-valueOf" 976 FAIL script.nonce: IDL set to "+100" assert_equals: getAttribute() expected "+100" but got "test-valueOf" 977 FAIL script.nonce: IDL set to ".5" assert_equals: getAttribute() expected ".5" but got "test-valueOf" 978 FAIL script.nonce: IDL set to true assert_equals: getAttribute() expected "true" but got "test-valueOf" 979 FAIL script.nonce: IDL set to false assert_equals: getAttribute() expected "false" but got "test-valueOf" 980 FAIL script.nonce: IDL set to object "[object Object]" assert_equals: getAttribute() expected "[object Object]" but got "test-valueOf" 981 FAIL script.nonce: IDL set to NaN assert_equals: getAttribute() expected "NaN" but got "test-valueOf" 982 FAIL script.nonce: IDL set to Infinity assert_equals: getAttribute() expected "Infinity" but got "test-valueOf" 983 FAIL script.nonce: IDL set to -Infinity assert_equals: getAttribute() expected "-Infinity" but got "test-valueOf" 984 FAIL script.nonce: IDL set to "\0" assert_equals: getAttribute() expected "\0" but got "test-valueOf" 985 FAIL script.nonce: IDL set to null assert_equals: getAttribute() expected "null" but got "test-valueOf" 986 FAIL script.nonce: IDL set to object "test-toString" assert_equals: getAttribute() expected "test-toString" but got "test-valueOf" 987 987 PASS script.nonce: IDL set to object "test-valueOf" 988 988 PASS script.integrity: typeof IDL attribute -
trunk/LayoutTests/platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r281569 r285478 335 335 PASS HTMLElement interface: attribute inputMode 336 336 PASS HTMLElement interface: attribute dataset 337 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false337 PASS HTMLElement interface: attribute nonce 338 338 FAIL HTMLElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 339 339 PASS HTMLElement interface: attribute tabIndex … … 430 430 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 431 431 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 432 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 432 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 433 433 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type assert_inherits: property "autofocus" not found in prototype chain 434 434 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5336 5336 PASS SVGElement interface: attribute onpaste 5337 5337 PASS SVGElement interface: attribute dataset 5338 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5338 PASS SVGElement interface: attribute nonce 5339 5339 FAIL SVGElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 5340 5340 PASS SVGElement interface: attribute tabIndex -
trunk/LayoutTests/platform/mac-wk1/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r285346 r285478 337 337 PASS HTMLElement interface: attribute inputMode 338 338 PASS HTMLElement interface: attribute dataset 339 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false339 PASS HTMLElement interface: attribute nonce 340 340 PASS HTMLElement interface: attribute autofocus 341 341 PASS HTMLElement interface: attribute tabIndex … … 434 434 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 435 435 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 436 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 436 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 437 437 PASS HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type 438 438 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5373 5373 PASS SVGElement interface: attribute onpaste 5374 5374 PASS SVGElement interface: attribute dataset 5375 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5375 PASS SVGElement interface: attribute nonce 5376 5376 PASS SVGElement interface: attribute autofocus 5377 5377 PASS SVGElement interface: attribute tabIndex -
trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r284960 r285478 335 335 PASS HTMLElement interface: attribute inputMode 336 336 PASS HTMLElement interface: attribute dataset 337 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false337 PASS HTMLElement interface: attribute nonce 338 338 PASS HTMLElement interface: attribute autofocus 339 339 PASS HTMLElement interface: attribute tabIndex … … 430 430 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 431 431 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 432 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 432 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 433 433 PASS HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type 434 434 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5336 5336 PASS SVGElement interface: attribute onpaste 5337 5337 PASS SVGElement interface: attribute dataset 5338 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5338 PASS SVGElement interface: attribute nonce 5339 5339 PASS SVGElement interface: attribute autofocus 5340 5340 PASS SVGElement interface: attribute tabIndex -
trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/dom/reflection-misc-expected.txt
r284960 r285478 968 968 PASS script.nonce: setAttribute() to object "test-toString" 969 969 PASS script.nonce: setAttribute() to object "test-valueOf" 970 PASS script.nonce: IDL set to ""971 PASS script.nonce: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo"972 PASS script.nonce: IDL set to undefined 973 PASS script.nonce: IDL set to 7 974 PASS script.nonce: IDL set to 1.5 975 PASS script.nonce: IDL set to "5%"976 PASS script.nonce: IDL set to "+100"977 PASS script.nonce: IDL set to ".5"978 PASS script.nonce: IDL set to true 979 PASS script.nonce: IDL set to false 980 PASS script.nonce: IDL set to object "[object Object]"981 PASS script.nonce: IDL set to NaN 982 PASS script.nonce: IDL set to Infinity 983 PASS script.nonce: IDL set to -Infinity 984 PASS script.nonce: IDL set to "\0"985 PASS script.nonce: IDL set to null 986 PASS script.nonce: IDL set to object "test-toString"970 FAIL script.nonce: IDL set to "" assert_equals: getAttribute() expected "" but got "test-valueOf" 971 FAIL script.nonce: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " assert_equals: getAttribute() expected " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " but got "test-valueOf" 972 FAIL script.nonce: IDL set to undefined assert_equals: getAttribute() expected "undefined" but got "test-valueOf" 973 FAIL script.nonce: IDL set to 7 assert_equals: getAttribute() expected "7" but got "test-valueOf" 974 FAIL script.nonce: IDL set to 1.5 assert_equals: getAttribute() expected "1.5" but got "test-valueOf" 975 FAIL script.nonce: IDL set to "5%" assert_equals: getAttribute() expected "5%" but got "test-valueOf" 976 FAIL script.nonce: IDL set to "+100" assert_equals: getAttribute() expected "+100" but got "test-valueOf" 977 FAIL script.nonce: IDL set to ".5" assert_equals: getAttribute() expected ".5" but got "test-valueOf" 978 FAIL script.nonce: IDL set to true assert_equals: getAttribute() expected "true" but got "test-valueOf" 979 FAIL script.nonce: IDL set to false assert_equals: getAttribute() expected "false" but got "test-valueOf" 980 FAIL script.nonce: IDL set to object "[object Object]" assert_equals: getAttribute() expected "[object Object]" but got "test-valueOf" 981 FAIL script.nonce: IDL set to NaN assert_equals: getAttribute() expected "NaN" but got "test-valueOf" 982 FAIL script.nonce: IDL set to Infinity assert_equals: getAttribute() expected "Infinity" but got "test-valueOf" 983 FAIL script.nonce: IDL set to -Infinity assert_equals: getAttribute() expected "-Infinity" but got "test-valueOf" 984 FAIL script.nonce: IDL set to "\0" assert_equals: getAttribute() expected "\0" but got "test-valueOf" 985 FAIL script.nonce: IDL set to null assert_equals: getAttribute() expected "null" but got "test-valueOf" 986 FAIL script.nonce: IDL set to object "test-toString" assert_equals: getAttribute() expected "test-toString" but got "test-valueOf" 987 987 PASS script.nonce: IDL set to object "test-valueOf" 988 988 PASS script.integrity: typeof IDL attribute -
trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt
r284839 r285478 335 335 PASS HTMLElement interface: attribute inputMode 336 336 PASS HTMLElement interface: attribute dataset 337 FAIL HTMLElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false337 PASS HTMLElement interface: attribute nonce 338 338 FAIL HTMLElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 339 339 PASS HTMLElement interface: attribute tabIndex … … 430 430 PASS HTMLElement interface: document.createElement("noscript") must inherit property "inputMode" with the proper type 431 431 PASS HTMLElement interface: document.createElement("noscript") must inherit property "dataset" with the proper type 432 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type assert_inherits: property "nonce" not found in prototype chain 432 PASS HTMLElement interface: document.createElement("noscript") must inherit property "nonce" with the proper type 433 433 FAIL HTMLElement interface: document.createElement("noscript") must inherit property "autofocus" with the proper type assert_inherits: property "autofocus" not found in prototype chain 434 434 PASS HTMLElement interface: document.createElement("noscript") must inherit property "tabIndex" with the proper type … … 5336 5336 PASS SVGElement interface: attribute onpaste 5337 5337 PASS SVGElement interface: attribute dataset 5338 FAIL SVGElement interface: attribute nonce assert_true: The prototype object must have a property "nonce" expected true got false5338 PASS SVGElement interface: attribute nonce 5339 5339 FAIL SVGElement interface: attribute autofocus assert_true: The prototype object must have a property "autofocus" expected true got false 5340 5340 PASS SVGElement interface: attribute tabIndex -
trunk/Source/WebCore/ChangeLog
r285475 r285478 1 2021-11-08 Patrick Griffis <pgriffis@igalia.com> 2 3 Implement nonce-hiding 4 https://bugs.webkit.org/show_bug.cgi?id=179728 5 6 Reviewed by Chris Dumez. 7 8 This is a hardening technique implemented by both Firefox and Chromium. 9 10 The behavior is documented here: https://html.spec.whatwg.org/multipage/urls-and-fetching.html#nonce-attributes 11 12 * dom/Element.cpp: 13 (WebCore::Element::nonce const): 14 (WebCore::Element::setNonce): 15 (WebCore::Element::hideNonce): 16 (WebCore::Element::attributeChanged): 17 (WebCore::Element::cloneAttributesFromElement): 18 * dom/Element.h: 19 * dom/ElementRareData.cpp: 20 * dom/ElementRareData.h: 21 (WebCore::ElementRareData::nonce const): 22 (WebCore::ElementRareData::setNonce): 23 (WebCore::ElementRareData::useTypes const): 24 * dom/InlineClassicScript.cpp: 25 (WebCore::InlineClassicScript::create): 26 * dom/InlineStyleSheetOwner.cpp: 27 (WebCore::InlineStyleSheetOwner::createSheet): 28 * dom/NodeRareData.h: 29 * dom/ScriptElement.cpp: 30 (WebCore::ScriptElement::requestClassicScript): 31 (WebCore::ScriptElement::requestModuleScript): 32 (WebCore::ScriptElement::executeClassicScript): 33 * html/HTMLElement.cpp: 34 (WebCore::HTMLElement::insertedIntoAncestor): 35 * html/HTMLElement.h: 36 * html/HTMLOrForeignElement.idl: 37 * html/HTMLScriptElement.idl: 38 * page/csp/ContentSecurityPolicy.cpp: 39 (WebCore::ContentSecurityPolicy::didReceiveHeader): 40 * page/csp/ContentSecurityPolicy.h: 41 (WebCore::ContentSecurityPolicy::isHeaderDelivered const): 42 * svg/SVGElement.cpp: 43 (WebCore::SVGElement::insertedIntoAncestor): 44 1 45 2021-11-08 J Pascoe <j_pascoe@apple.com> 2 46 -
trunk/Source/WebCore/dom/Element.cpp
r284960 r285478 315 315 } 316 316 317 const AtomString& Element::nonce() const 318 { 319 return hasRareData() ? elementRareData()->nonce() : emptyAtom(); 320 } 321 322 void Element::setNonce(const AtomString& newValue) 323 { 324 if (newValue == emptyAtom() && !hasRareData()) 325 return; 326 327 ensureElementRareData().setNonce(newValue); 328 } 329 330 void Element::hideNonce() 331 { 332 // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#nonce-attributes 333 if (!isConnected()) 334 return; 335 336 const auto& csp = document().contentSecurityPolicy(); 337 if (!csp->isHeaderDelivered()) 338 return; 339 340 // Retain previous IDL nonce. 341 AtomString currentNonce = nonce(); 342 343 if (!getAttribute(nonceAttr).isEmpty()) 344 setAttribute(nonceAttr, emptyAtom()); 345 346 setNonce(currentNonce); 347 } 348 317 349 bool Element::supportsFocus() const 318 350 { … … 1861 1893 } else if (name == HTMLNames::nameAttr) 1862 1894 elementData()->setHasNameAttribute(!newValue.isNull()); 1863 else if (name == HTMLNames::pseudoAttr) { 1895 else if (name == HTMLNames::nonceAttr) { 1896 if (is<HTMLElement>(*this) || is<SVGElement>(*this)) 1897 setNonce(newValue.isNull() ? emptyAtom() : newValue); 1898 } else if (name == HTMLNames::pseudoAttr) { 1864 1899 if (needsStyleInvalidation() && isInShadowTree()) 1865 1900 invalidateStyleForSubtree(); … … 4484 4519 for (const Attribute& attribute : attributesIterator()) 4485 4520 attributeChanged(attribute.name(), nullAtom(), attribute.value(), ModifiedByCloning); 4521 4522 setNonce(other.nonce()); 4486 4523 } 4487 4524 -
trunk/Source/WebCore/dom/Element.h
r284693 r285478 360 360 virtual RefPtr<Element> focusDelegate(); 361 361 362 // Used by the HTMLElement and SVGElement IDLs. 363 WEBCORE_EXPORT const AtomString& nonce() const; 364 WEBCORE_EXPORT void setNonce(const AtomString&); 365 void hideNonce(); 366 362 367 ExceptionOr<void> insertAdjacentHTML(const String& where, const String& html, NodeVector* addedNodes); 363 368 -
trunk/Source/WebCore/dom/ElementRareData.cpp
r282628 r285478 38 38 IntPoint savedLayerScrollPosition; 39 39 Vector<std::unique_ptr<ElementAnimationRareData>> animationRareData; 40 void* pointers[1 0];40 void* pointers[11]; 41 41 void* intersectionObserverData; 42 42 #if ENABLE(CSS_TYPED_OM) -
trunk/Source/WebCore/dom/ElementRareData.h
r282628 r285478 103 103 ResizeObserverData* resizeObserverData() { return m_resizeObserverData.get(); } 104 104 void setResizeObserverData(std::unique_ptr<ResizeObserverData>&& data) { m_resizeObserverData = WTFMove(data); } 105 106 const AtomString& nonce() const { return m_nonce; } 107 void setNonce(const AtomString& value) { m_nonce = value; } 105 108 106 109 #if ENABLE(CSS_TYPED_OM) … … 147 150 if (!m_partNames.isEmpty()) 148 151 result.add(UseType::PartNames); 152 if (m_nonce) 153 result.add(UseType::Nonce); 149 154 return result; 150 155 } … … 178 183 SpaceSplitString m_partNames; 179 184 185 AtomString m_nonce; 186 180 187 void releasePseudoElement(PseudoElement*); 181 188 }; -
trunk/Source/WebCore/dom/InlineClassicScript.cpp
r283851 r285478 37 37 auto& element = scriptElement.element(); 38 38 return adoptRef(*new InlineClassicScript( 39 element. attributeWithoutSynchronization(HTMLNames::nonceAttr),39 element.nonce(), 40 40 element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr), 41 41 scriptElement.scriptCharset(), -
trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp
r284067 r285478 169 169 ASSERT(document.contentSecurityPolicy()); 170 170 const ContentSecurityPolicy& contentSecurityPolicy = *document.contentSecurityPolicy(); 171 bool hasKnownNonce = contentSecurityPolicy.allowStyleWithNonce(element. attributeWithoutSynchronization(HTMLNames::nonceAttr), element.isInUserAgentShadowTree());171 bool hasKnownNonce = contentSecurityPolicy.allowStyleWithNonce(element.nonce(), element.isInUserAgentShadowTree()); 172 172 if (!contentSecurityPolicy.allowInlineStyle(document.url().string(), m_startTextPosition.m_line, text, CheckUnsafeHashes::No, hasKnownNonce)) 173 173 return; -
trunk/Source/WebCore/dom/NodeRareData.h
r268695 r285478 264 264 PartList = 1 << 16, 265 265 PartNames = 1 << 17, 266 Nonce = 1 << 18, 266 267 }; 267 268 #endif -
trunk/Source/WebCore/dom/ScriptElement.cpp
r284857 r285478 292 292 if (!stripLeadingAndTrailingHTMLSpaces(sourceURL).isEmpty()) { 293 293 auto script = LoadableClassicScript::create( 294 m_element. attributeWithoutSynchronization(HTMLNames::nonceAttr),294 m_element.nonce(), 295 295 m_element.document().settings().subresourceIntegrityEnabled() ? m_element.attributeWithoutSynchronization(HTMLNames::integrityAttr).string() : emptyString(), 296 296 referrerPolicy(), … … 305 305 306 306 const auto& contentSecurityPolicy = *m_element.document().contentSecurityPolicy(); 307 if (!contentSecurityPolicy.allowNonParserInsertedScripts(scriptURL, m_element. attributeWithoutSynchronization(HTMLNames::nonceAttr), String(), m_parserInserted))307 if (!contentSecurityPolicy.allowNonParserInsertedScripts(scriptURL, m_element.nonce(), String(), m_parserInserted)) 308 308 return false; 309 309 … … 327 327 // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#cors-settings-attributes 328 328 // Module is always CORS request. If attribute is not given, it should be same-origin credential. 329 String nonce = m_element. attributeWithoutSynchronization(HTMLNames::nonceAttr);329 String nonce = m_element.nonce(); 330 330 String crossOriginMode = m_element.attributeWithoutSynchronization(HTMLNames::crossoriginAttr); 331 331 if (crossOriginMode.isNull()) … … 398 398 ASSERT(m_element.document().contentSecurityPolicy()); 399 399 const ContentSecurityPolicy& contentSecurityPolicy = *m_element.document().contentSecurityPolicy(); 400 if (!contentSecurityPolicy.allowNonParserInsertedScripts(m_element.document().url(), m_element. attributeWithoutSynchronization(HTMLNames::nonceAttr), sourceCode.source(), m_parserInserted))400 if (!contentSecurityPolicy.allowNonParserInsertedScripts(m_element.document().url(), m_element.nonce(), sourceCode.source(), m_parserInserted)) 401 401 return; 402 402 403 bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(m_element. attributeWithoutSynchronization(HTMLNames::nonceAttr), m_element.isInUserAgentShadowTree());403 bool hasKnownNonce = contentSecurityPolicy.allowScriptWithNonce(m_element.nonce(), m_element.isInUserAgentShadowTree()); 404 404 if (!contentSecurityPolicy.allowInlineScript(m_element.document().url().string(), m_startLineNumber, sourceCode.source(), hasKnownNonce)) 405 405 return; -
trunk/Source/WebCore/html/HTMLElement.cpp
r285425 r285478 500 500 } 501 501 502 Node::InsertedIntoAncestorResult HTMLElement::insertedIntoAncestor(InsertionType insertionType, ContainerNode& containerNode) 503 { 504 auto result = Element::insertedIntoAncestor(insertionType, containerNode); 505 hideNonce(); 506 return result; 507 } 508 502 509 static Ref<DocumentFragment> textToFragment(Document& document, const String& text) 503 510 { -
trunk/Source/WebCore/html/HTMLElement.h
r285425 r285478 167 167 bool matchesReadWritePseudoClass() const override; 168 168 void parseAttribute(const QualifiedName&, const AtomString&) override; 169 Node::InsertedIntoAncestorResult insertedIntoAncestor(InsertionType , ContainerNode& parentOfInsertedTree) override; 169 170 bool hasPresentationalHintsForAttribute(const QualifiedName&) const override; 170 171 void collectPresentationalHintsForAttribute(const QualifiedName&, const AtomString&, MutableStyleProperties&) override; -
trunk/Source/WebCore/html/HTMLOrForeignElement.idl
r284960 r285478 29 29 interface mixin HTMLOrForeignElement { 30 30 [SameObject] readonly attribute DOMStringMap dataset; 31 // FIXME: Implement 'nonce'. 32 // attribute DOMString nonce; // intentionally no [CEReactions] 31 attribute DOMString nonce; // intentionally no [CEReactions] 33 32 34 33 [CEReactions=NotNeeded, Reflect] attribute boolean autofocus; -
trunk/Source/WebCore/html/HTMLScriptElement.idl
r283463 r285478 31 31 [CEReactions=NotNeeded, Reflect] attribute DOMString type; 32 32 [CEReactions=NotNeeded] attribute DOMString? crossOrigin; 33 [Reflect] attribute DOMString nonce;34 33 [CEReactions=NotNeeded, Reflect] attribute boolean noModule; 35 34 [CEReactions=NotNeeded, Reflect, EnabledBySetting=SubresourceIntegrityEnabled] attribute DOMString integrity; -
trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp
r285320 r285478 196 196 ASSERT(m_policies.isEmpty()); 197 197 m_hasAPIPolicy = true; 198 } 198 } else if (policyFrom == PolicyFrom::HTTPHeader) 199 m_isHeaderDelivered = true; 199 200 200 201 m_cachedResponseHeaders = std::nullopt; -
trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h
r285320 r285478 186 186 SandboxFlags sandboxFlags() const { return m_sandboxFlags; } 187 187 188 bool isHeaderDelivered() const { return m_isHeaderDelivered; } 189 188 190 private: 189 191 void logToConsole(const String& message, const String& contextURL = String(), const OrdinalNumber& contextLine = OrdinalNumber::beforeFirst(), const OrdinalNumber& contextColumn = OrdinalNumber::beforeFirst(), JSC::JSGlobalObject* = nullptr) const; … … 248 250 HashSet<SecurityOriginData> m_insecureNavigationRequestsToUpgrade; 249 251 mutable std::optional<ContentSecurityPolicyResponseHeaders> m_cachedResponseHeaders; 252 bool m_isHeaderDelivered { false }; 250 253 }; 251 254 -
trunk/Source/WebCore/svg/SVGElement.cpp
r284693 r285478 895 895 } 896 896 897 hideNonce(); 898 897 899 return InsertedIntoAncestorResult::Done; 898 900 }
Note:
See TracChangeset
for help on using the changeset viewer.