mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-10 15:09:00 +02:00
feat(browse): allow Emulation.setEmulatedMedia on the CDP allowlist (re-derived from #2419)
Adds Emulation.setEmulatedMedia to the deny-default CDP allowlist: tab-scoped, trusted output (returns an empty result — no page content). Unlocks media type/feature overrides (prefers-color-scheme, prefers-reduced-motion, prefers-contrast, forced-colors) via `$B cdp`, so dark-mode and a11y CSS branches are testable without a headed toggle. Like setUserAgentOverride, the override persists on the tab until cleared with an empty features array — noted in the entry's justification. Registry test pins the entry (allowed + tab scope + trusted output); the PR's VERSION/CHANGELOG stamping is stripped per wave convention (versioning happens at /ship). Tests: cdp-allowlist 7 pass, 0 fail. Re-derived from PR #2419 by @meshailabs. Co-authored-by: meshailabs <devsupport@meshai.dev> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
meshailabs
Claude Fable 5
parent
be66d4f06f
commit
0cbaeadc66
@@ -70,6 +70,18 @@ describe('CDP allowlist (T2: deny-default)', () => {
|
||||
expect(isCdpMethodAllowed('Page.captureScreenshot')).toBe(true);
|
||||
});
|
||||
|
||||
it('Emulation.setEmulatedMedia is allowed, tab-scoped, trusted (#2419)', () => {
|
||||
// Media type/feature override (prefers-color-scheme, prefers-reduced-motion,
|
||||
// prefers-contrast, forced-colors) so a11y and dark-mode CSS branches are
|
||||
// testable via $B cdp. Returns an empty result — no page content, so
|
||||
// trusted output is correct.
|
||||
expect(isCdpMethodAllowed('Emulation.setEmulatedMedia')).toBe(true);
|
||||
const e = lookupCdpMethod('Emulation.setEmulatedMedia');
|
||||
expect(e).not.toBeNull();
|
||||
expect(e!.scope).toBe('tab');
|
||||
expect(e!.output).toBe('trusted');
|
||||
});
|
||||
|
||||
it('untrusted-output methods cover the read-everything-attacker-controlled cases', () => {
|
||||
// Anything that reads attacker-controlled strings (DOM/AX/CSS selectors)
|
||||
// should be tagged untrusted so the envelope wraps the result.
|
||||
|
||||
Reference in New Issue
Block a user