[Security] screen-share list/thumbnail commands reachable from third-party page origin (follow-up to #809)
Summary
The getDisplayMedia picker shim landed in #809 uses two Tauri commands — screen_share_list_sources and screen_share_thumbnail — that are allowed from the recipe-webview scope so the injected picker can enumerate sources and lazy-fetch thumbnails. CodeRabbit flagged this on the PR as a privacy/security blocker: any script running inside the embedded site (Meet, Slack, Discord, etc.) can call window.__TAURI_INTERNALS__.invoke('screen_share_list_sources') directly, bypassing our UI, and get back every open window's title plus live PNG thumbnails without any user gesture.
This is a drive-by fingerprinting surface (what apps the user has open) and — via screen_share_thumbnail — an unauthenticated screenshot primitive as long as macOS Screen Recording permission has been granted once.
Proposal
Move the enumeration data flow host-side while keeping the picker UI inside the child webview (per the #713 UX requirement):
- Remove
screen_share_list_sourcesandscreen_share_thumbnailfromallow-webview-recipe.toml. - When
OnRequestMediaAccessPermissionfires for DESKTOP_VIDEO_CAPTURE in tauri-cef, hold the media access callback and:- Generate a short-lived session token.
- Enumerate sources host-side.
- Emit a
screen-share-session-beginevent scoped to the originating browser with the source list + opaque per-session IDs.
- Shim listens for that event, renders the picker from the event payload.
- Shim invokes a new
screen_share_resolve_pick(token, opaqueId)host command; host translates opaque → real DesktopMediaID, the callback is resolved with DESKTOP_VIDEO_CAPTURE, and the shim then callsgetUserMediawith the real ID. - Thumbnails: either include base64 PNGs in the initial event payload (higher up-front cost, simpler) or expose a
screen_share_thumbnail(token, opaqueId)command gated on the active session.
The third-party page can still try to fake the flow but without an in-flight OnRequestMediaAccessPermission event it has no token and the commands reject.
Scope
app/src-tauri/vendor/tauri-cef/crates/tauri-runtime-cef— expose an async hook aroundOnRequestMediaAccessPermissionso the host can delay the callback while the shim runs the picker.app/src-tauri/src/screen_capture/— session state + token generation + opaque ID map.app/src-tauri/src/webview_accounts/runtime.js— shim switches frominvoke('screen_share_list_sources')to listening forscreen-share-session-beginevent + sending the pick back.app/src-tauri/permissions/allow-webview-recipe.toml— drop the screen-share command entries.
Related
- PR #809 landed the picker and in-page shim.
- Issue #713 AC2 (Meet screen share picker) is what drove the original implementation.
- CodeRabbit inline comment on
app/src-tauri/permissions/allow-webview-recipe.toml:6in PR #809.
@oxoxDev bro this was done na ?
@graycyrus Yes bro