[Clipboard-Read P0] Add ClipboardRead device permission + telemetry + runtime flag - #3087
Draft
Leah-Xia-Microsoft wants to merge 1 commit into
Draft
[Clipboard-Read P0] Add ClipboardRead device permission + telemetry + runtime flag#3087Leah-Xia-Microsoft wants to merge 1 commit into
Leah-Xia-Microsoft wants to merge 1 commit into
Conversation
Additive P0 groundwork for the updated clipboard-read architecture (ADO Feature 11070811 / Task 12061800). No behavior change. - interfaces.ts: add DevicePermission.ClipboardRead = 'clipboard-read' (value matches the browser Permissions-Policy token so hosts can use it verbatim in the app iframe allow attribute) - telemetry.ts: add Clipboard_HasPermission / Clipboard_RequestPermission - runtime.ts: add clipboard.native capability marker (v4) so old hosts fall back cleanly to the legacy proxied clipboard path Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ee7bfe63-ba23-4db3-ba82-960182852055
Contributor
|
This pull request contains changes to the runtime.ts file. If you, as the author of this PR, have made changes to the Runtime interface please review RUNTIME.md to determine if a new runtime version is required. Please reply to this comment stating what changes, if any, were made to the runtime object and whether a new runtime version was required. |
Contributor
size-limit report 📦
|
MengyiGong
approved these changes
Jul 15, 2026
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.
Summary
P0 of the Updated architecture for clipboard read using device permissions effort. This is the additive, no-behavior-change foundation that lets a later change move
clipboard.read()onto the browser-native Clipboard API (navigator.clipboard.read) gated by a device-permission consent flow, replacing the deprecated host-proxiedclipboard.readFromClipboardpath.@metaos/hub-sdkadds the matchingDevicePermission.ClipboardReadvalue.Why
Today
clipboard.read()is proxied: the app asks the host to read the OS clipboard and marshals aBlobback over the postMessage bridge. The capability was marked@deprecated(v2.54.0). The standards-based replacement is for the app to callnavigator.clipboard.read()itself — but that requires (1) aclipboard-readdevice permission + consent, and (2) the host delegatingclipboard-readvia the iframeallowPermissions-Policy. This PR lays the guest-SDK groundwork for that; the actualread()rework is P2.Changes (all additive)
public/interfaces.tsDevicePermission.ClipboardRead = 'clipboard-read'. The value deliberately matches the browser Permissions-Policy feature token so the host can emit it verbatim into the iframeallowattribute.internal/telemetry.tsClipboard_HasPermissionandClipboard_RequestPermissionApiNameentries, following the existing*_HasPermission/*_RequestPermissionconvention.public/runtime.tsclipboard.nativecapability marker on the v4 runtime. When present, the host supports the native app-frame clipboard-read path; when absent (older hosts), consumers fall back to the legacy proxied path.Not in this PR (scoped out / later phases)
clipboard.hasPermission()/requestPermission()and the nativeread()implementation with proxy fallback (teams-js).clipboard.write()or any existing permission.clipboard-writebehavior is untouched.Compatibility
Purely additive: a new enum member, two telemetry names, and an optional runtime sub-flag. Nothing branches on these yet, so there is no behavior change and no impact on existing hosts or apps. Old hosts simply won't advertise
clipboard.native.Validation
tsc --noEmitpasses.eslintpasses (0 warnings) on the changed files.minor).Reviewer notes
clipboard.nativemarker is intentionally generic to accommodate either.ClipboardReadnaming/value is chosen to stay forward-compatible with any future unified device-permission enum, to avoid a later rename.