Closed Bug 2080561 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63515 - [PermissionsPolicy] Fix Allowlist::Contains() to match opaque origins for '*'

Categories

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

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Hiroshige Hayashizaki <hiroshige@chromium.org> wrote:

[PermissionsPolicy] Fix Allowlist::Contains() to match opaque origins for '*'

This CL makes PermissionsPolicy::Allowlist::Contains() return true
for matches_all_origins_ (* policies) even for opaque origins, so
that a wildcard allowlist '*' matches all origins, including opaque
origins (e.g. sandboxed iframes or data: URL frames).

This new behavior aligns with:

The check order changes in this CL are:

  • Check matches_all_origins_ first. This intentionally changes the
    behavior as specified, which is covered by the added unit tests and
    WPTs.
  • Check opaque origins before allowed_origins_. This doesn't change
    the behavior, because DoesMatchOrigin() always returns false for
    opaque origins.

This CL also updates
PermissionsPolicyTest.TestSandboxedFrameFromHeaderPolicy to properly
pass an empty container policy, matching its comments and ASCII diagram.

Unit tests in permissions_policy_unittest.cc (which mostly corresponds
to the tests to be deleted in https://crrev.com/c/8464750) and WPT tests
for wildcard '*' container policies with sandboxed and data: URL frames
are added.

This also fixes the behavior of Worker permissions policy
(crbug.com/562705553) around data: workers, as
PermissionsPolicy::Allowlist::Contains() can be called e.g. from
ExecutionContext::IsFeatureEnabled() from
https://crrev.com/c/8426410/10/third_party/blink/renderer/core/workers/shared_worker.cc#298

Bug: 565859110, 562705553
Change-Id: Ife867aba7e8309f499ffdce3304b288dfc50508d
TAG=agy
CONV=c5b4675c-907b-4a62-821b-dc605b21d806

Reviewed-on: https://chromium-review.googlesource.com/8464749
WPT-Export-Revision: 0d7050e3958590cb24d80894e5d1aceb219aef54

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

CI Results

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

Total 2 tests and 1 subtests

Status Summary

Firefox

TIMEOUT: 4

Chrome

OK : 2
PASS : 2

Safari

TIMEOUT: 4

Links

GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/e665f57ae880 https://hg.mozilla.org/integration/autoland/rev/7a0147e0d388 [wpt PR 63515] - [PermissionsPolicy] Fix Allowlist::Contains() to match opaque origins for '*', a=testonly
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.