fix(juggler): restore scoped closed-shadow access - #685
Open
Cloudymap1e wants to merge 1 commit into
Open
Conversation
JWriter20
added a commit
to JWriter20/camoufox
that referenced
this pull request
Jul 30, 2026
…ld (daijro#628) `forceScopeAccess` was declared in settings/properties.json and settings/camoucfg.jvv, validated on the way in, and then read by nothing -- grep found no consumer anywhere in additions/juggler/. So `element.shadowRootUnl`, which patches/shadow-root-bypass.patch adds to Element.webidl gated on Func="Document::IsCallerChromeOrAddon", was `undefined` from page.evaluate() no matter what the flag was set to. Reproduced on 152.0.4-beta.28. The gate tests the caller, not the world the property is defined in. So export a getter whose body stays in FrameTree.js's system-principal scope and install it on the page's own Element.prototype. The default execution context is left alone: page.evaluate() still runs against the real page window. Deliberately NOT taking PR daijro#685's shape. It unlocks the same binding by swapping the default main world for a Cu.Sandbox over the page window, and with Xray vision that hides page expandos -- its own tests assert `page.evaluate('window.pageSecret') is None` and `element.pageMarker is None`. Enabling a shadow-DOM flag should not silently stop page.evaluate() from seeing page state; that is a much worse failure than the two caveats below, and it is undocumented in the PR. The trade-offs of keeping evaluation in the main world, both documented at the call site: the property is visible to the page while the flag is on (so it can be fingerprinted -- hence opt-in and off by default), and a page that defines its own `shadowRootUnl` on an element shadows the accessor. A page can only do either if it already knows the property exists. Credit to @Cloudymap1e (daijro#685) for the Cu.exportFunction technique this reuses. Adds tests/patches/force-scope-access.py, which pins both halves: the binding works with the flag on, is absent with it off, and main-world evaluation sees page globals, page expandos and element handles identically in both modes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
Closes #628
Description
The Firefox 146 Juggler ESM migration stopped honoring
forceScopeAccess, so trusted automation could no longer reach the chrome-onlyshadowRootUnlaccessor used for closed shadow roots.This restores the historical explicit opt-in behavior without changing the default context or elevating the evaluator to the system principal. When
forceScopeAccessis enabled, Juggler uses the same page-scoped expanded-principal/Xray pattern as its isolated worlds and installs one compartment-localshadowRootUnlgetter. A narrowly exported callback backs that getter and returns only the native chrome-only shadow-root attribute; its temporary global binding is deleted immediately. Page scripts cannot see the accessor, hostile page expandos cannot intercept it, and no chrome helper or system-principal evaluation realm is exposed. When the setting is absent, Juggler continues to execute against the existing content-page window.Type of Change
Testing
shadowRootUnlfetch, cross-origin XHR, andfile://fetch all remained blockednode --check additions/juggler/content/FrameTree.js: passedFingerprint Report
build-tester/run_tests.sh ... --no-certreported grade A with 1025/1048 checks across eight profiles, above the PR checklist's required score of 1000. The harness returned status 1 because it requires 1048/1048 for a zero exit; all 23 misses were local screen-size expectation differences on the bounded 1920x1080 validation host.Validated artifact
omni.jaSHA-256:b6ee2601d86c79481c4a734f7d995d6c211b4aeeadadd19246fa8ae8613d86e5.Checklist
Service tests pass (for python library changes) -temporarily out of service lol./service-tester/run_tests.sh --browser-version official/prerelease/146.0.1-alpha.25(attach screenshot)