Closed Bug 2056709 Opened 4 months ago Closed

[wpt-sync] Sync PR 61458 - WebMCP: Prevent tool execution in opaque origins

Categories

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

task

Tracking

(firefox155 fixed)

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Dominic Farolino <dom@chromium.org> wrote:

WebMCP: Prevent tool execution in opaque origins

It's impossible to represent an opaque origin faithfully in JavaScript,
since there is no Origin object that could hold the internal nonce of
an opaque origin. Instead, opaque origins just lossily serialize to
"null".

This means if an opaque origin registers a WebMCP tool, any document
that can view the tool cannot execute it! This is because to execute
a tool, you must provide a RegisteredTool dictionary containing a
stringified origin. For opaque origin tools, this string will never
capture the tool host's real origin, and the browser process will fail
1 the execution because the expected origin is cross-origin.

When spec'ing executeTool(), I realized that it's cleanest and more
predictable to just fail this in the renderer process up-front, where
we have the most information. So this CL synchronously rejects tool
execution Promises bound for opaque-origin tools.

This is a temporary limitation until https://crbug.com/536063275 is
solved.

R=masonf

Bug: 489045948,536063275
Change-Id: I45e9a6000d7008dd94f1db3e3c80c9697b9cb7da

Reviewed-on: https://chromium-review.googlesource.com/8121241
WPT-Export-Revision: bd0cce52021d0161ee9f321880157584e3fa6e72

CI Results

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

Total 50 tests and 1 subtests

Status Summary

Firefox

OK : 2[GitHub] 45[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]
PASS : 2
FAIL : 4[GitHub] 85[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]
ERROR : 2
NOTRUN: 1

Chrome

OK : 2
FAIL : 4

Safari

OK : 2
FAIL : 4

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: 4 months ago
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
You need to log in before you can comment on or make changes to this bug.