Closed Bug 2094989 Opened 10 days ago Closed 8 days ago

[wpt-sync] Sync PR 65047 - Make data: URL subframes secure contexts when their ancestors are

Categories

(Core :: DOM: Core & HTML, task, P4)

task

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Dominic Farolino <dom@chromium.org> wrote:

Make data: URL subframes secure contexts when their ancestors are

Per the HTML Standard, a window is a secure context if its
environment's top-level creation URL is potentially trustworthy
and not "data"-schemed. So a data: URL iframe whose top-level
document is a secure context must itself be a secure context.

Before this CL, Blink disagreed. A data: URL document's origin is
opaque, and SecurityContext::SetSecurityOrigin() treated any
untrustworthy origin as insecure without consulting ancestors.
Same-process descendants of a data: URL iframe were insecure too,
because HasInsecureContextInAncestors() stopped at the data: URL
frame's opaque origin. The browser process already computed the data:
iframe as secure via the policy container.

This CL marks a data: URL subframe's opaque origin as potentially
trustworthy in DocumentLoader::CalculateOrigin() if none of its
ancestors are insecure.

The ancestor check is needed because the SecurityOrigin is aliased by
other documents: e.g., the initial about:blank of a popup opened by
the data: URL frame shares it and has no ancestors to walk, so
flagging the origin unconditionally would make such popups secure even
under an http: top-level document.

As a consequence, [SecureContext] APIs are now exposed in data: URL
iframes under secure contexts. Like sandboxed iframes (which are
already secure contexts with opaque origins), such APIs must handle
opaque origins themselves. Isolated-context-only APIs stay hidden from
data: URL iframes in Isolated Web Apps, since crrev.com/c/8723493 made
isolated-context status require a non-opaque origin; previously
[SecureContext] was their only per-frame gate there.

See the blink-dev@ PSA:
https://groups.google.com/a/chromium.org/g/blink-dev/c/D3lvhX3WkUw.

Bug: 584687955, 417215493
Change-Id: Iabe6285961ab58e82486874107c2a2bff2aed154
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8717534
Commit-Queue: Robbie McElrath \<rmcelrath@chromium.org>
Reviewed-by: Rakina Zata Amni \<rakina@chromium.org>
Reviewed-by: Simon Hangl \<simonha@google.com>
Auto-Submit: Dominic Farolino \<dom@chromium.org>
Reviewed-by: Robbie McElrath \<rmcelrath@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1741893}

Component: web-platform-tests → DOM: Core & HTML
Product: Testing → Core

CI Results

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

Total 3 tests and 6 subtests

Status Summary

Firefox

OK : 3
PASS: 13
FAIL: 3

Chrome

OK : 3
PASS: 10
FAIL: 6

Safari

OK : 3
PASS: 13
FAIL: 3

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

  • /file-system-access/opaque-origin.https.window.html [wpt.fyi]
    • showDirectoryPicker() must be defined for data URI iframes.: FAIL (Chrome: FAIL, Safari: FAIL)
    • navigator.storage.getDirectory() and showDirectoryPicker() must reject in a sandboxed iframe.: FAIL (Chrome: PASS, Safari: FAIL)
    • navigator.storage.getDirectory() and showDirectoryPicker() must reject in a sandboxed opened window.: FAIL (Chrome: PASS, Safari: FAIL)
Status: NEW → RESOLVED
Closed: 8 days ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
You need to log in before you can comment on or make changes to this bug.