Closed Bug 2060446 Opened 3 months ago Closed 3 months ago

[wpt-sync] Sync PR 61710 - [CORS] Tighten safelisted Range header value parsing

Categories

(Core :: DOM: Security, task, P4)

task

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Martin Verde <thesalsa@google.com> wrote:

[CORS] Tighten safelisted Range header value parsing

IsCorsSafelistedHeader() delegated the Range value check to the
permissive RFC-7233 parser net::HttpUtil::ParseRangeHeader, which
accepts values that the Fetch "simple range header value" algorithm
rejects: a leading sign on byte positions, "-1" as last-byte-pos,
and a case-insensitive "bytes=" prefix.

Replace the delegation with net::HttpUtil::ParseFetchSingleRange,
which strictly implements the Fetch "simple range header value"
algorithm (allow_whitespace=false). Additionally, reject values
that overflow int64_t by checking for std::numeric_limits\<int64_t>::max().

Bug: 513438970
Change-Id: Ie81a1b3b639cf9c5ae119be81c8956066e04fe69
TAG=agy
CONV=6c0675d2-d765-4cce-9da4-2bd9456132ec
Reviewed-on: https://chromium-review.googlesource.com/8189598
WPT-Export-Revision: 805d3b1002a5608072e0caf2c0fc64c6614b33bb

Component: web-platform-tests → DOM: Security
Product: Testing → Core

CI Results

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

Total 27 tests and 5 subtests

Status Summary

Firefox

OK : 2[GitHub] 26[Gecko-linux2404-64-debug] 27[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-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 88[GitHub] 449[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, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 4

Chrome

OK : 2
PASS: 76
FAIL: 12

Safari

OK : 2
PASS: 78
FAIL: 10

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /cors/304.htm [wpt.fyi]: OK [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-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt], SKIP [Gecko-linux2404-64-debug]
  • /cors/client-hint-request-headers-2.tentative.htm [wpt.fyi]
    • Client hint headers are simple headers: FAIL
  • /cors/simple-requests-ch.tentative.htm [wpt.fyi]
    • No preflight GET and {"save-data":"on","device-memory":"2.0","dpr":"3.0","width":"1200","viewport-width":"1300","rtt":"1","downlink":"1.0","ect":"2g"}: FAIL
    • No preflight HEAD and {"save-data":"on","device-memory":"2.0","dpr":"3.0","width":"1200","viewport-width":"1300","rtt":"1","downlink":"1.0","ect":"2g"}: FAIL
    • No preflight POST and {"save-data":"on","device-memory":"2.0","dpr":"3.0","width":"1200","viewport-width":"1300","rtt":"1","downlink":"1.0","ect":"2g"}: FAIL

Tests Disabled in Gecko Infrastructure

  • /cors/304.htm [wpt.fyi]: OK [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-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt], SKIP [Gecko-linux2404-64-debug]
Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/17300c627a5e https://hg.mozilla.org/integration/autoland/rev/4b95c345a500 [wpt PR 61710] - [CORS] Tighten safelisted Range header value parsing, a=testonly
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
You need to log in before you can comment on or make changes to this bug.