Closed Bug 2092464 Opened 19 days ago Closed 14 days ago

[wpt-sync] Sync PR 64554 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=323021

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(firefox162 fixed)

RESOLVED FIXED
162 Branch
Tracking Status
firefox162 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 64554 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/64554
Details from upstream follow.

Roberto Rodriguez <roberto_rodriguez2@apple.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=323021

WebKit export from bug: [<!---->CSP]<!----> Nonce-<!---->based CSP is bypassed by dangling markup placed before a nonced \<<!---->link><!---->

<pre>
[CSP] Nonce-based CSP is bypassed by dangling markup placed before a nonced <link>

Element::isNonceable() implements the CSP "is element nonceable" algorithm
(<a href="https://www.w3.org/TR/CSP3/#is-element-nonceable)">https://www.w3.org/TR/CSP3/#is-element-nonceable)</a> which officially only checks for '<script'
and '<style' in each attribute name and value to catch injected dangling markup and prevent
an unterminated script start tag from stealing a nonce from a legitimate element.
The algorithm currently doesn't check for '<link' even though <link> is nonceable.

Fix by also checking for '<link' in each attribute name and value. Nonces apply only to
script, style and link elements, so all three are now covered. Chrome has already made this
change and has proposed updating the CSP spec (<a href="https://github.com/w3c/webappsec-csp/pull/810).">https://github.com/w3c/webappsec-csp/pull/810).</a>

A WPT test exists for checking non-nonceable elements
(content-security-policy/script-src/non-nonceable-elements.html)
and WebKit currently fails its '<link' subtests, which this fix addresses. That test only
checks attribute values, so add a second similar test to cover attribute names.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=323021">https://bugs.webkit.org/show_bug.cgi?id=323021</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/320263@main">https://commits.webkit.org/320263@main</a>
</pre>

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]

CI Results

Ran 9 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 98 tests and 2 subtests

Status Summary

Firefox

OK : 1[GitHub] 96[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 97[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt]
PASS: 10[GitHub] 221[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt] 224[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt]
FAIL: 34

Chrome

OK : 1
PASS: 10

Safari

OK : 1
PASS: 10

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Tests Disabled in Gecko Infrastructure

Status: NEW → RESOLVED
Closed: 14 days ago
Resolution: --- → FIXED
Target Milestone: --- → 162 Branch
You need to log in before you can comment on or make changes to this bug.