openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

[Security] screen-share list/thumbnail commands reachable from third-party page origin (follow-up to #809)

Open oxoxDev opened this issue 7 months ago • 2 comments

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):

  1. Remove screen_share_list_sources and screen_share_thumbnail from allow-webview-recipe.toml.
  2. When OnRequestMediaAccessPermission fires 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-begin event scoped to the originating browser with the source list + opaque per-session IDs.
  3. Shim listens for that event, renders the picker from the event payload.
  4. 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 calls getUserMedia with the real ID.
  5. 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 around OnRequestMediaAccessPermission so 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 from invoke('screen_share_list_sources') to listening for screen-share-session-begin event + 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:6 in PR #809.

oxoxDev avatar Apr 22 '26 21:04 oxoxDev

@oxoxDev bro this was done na ?

graycyrus avatar Apr 24 '26 15:04 graycyrus

@graycyrus Yes bro

oxoxDev avatar Apr 24 '26 15:04 oxoxDev