Plugin iframes are not allowed to read the clipboard (allow="clipboard-write" only), so SSH Terminal's "Paste image" button does nothing
Environment
- Termix desktop 26.11.3, Windows 11 x64 (NSIS install), local backend
- SSH Terminal plugin 1.5.0, also with the build of Plugin-SSH-Terminal#104 (1.5.1)
What happens
Copy an image to the clipboard (a Snagit capture; clipboard formats are DeviceIndependentBitmap and DIBV5 only), open a terminal, then click Image → Paste image in the toolbar. Nothing happens: no upload request reaches the plugin's backend and no error is shown in the UI.
Ctrl+V in the terminal with the same clipboard works: the image is uploaded and its path is pasted. That path uses the paste event, not the Clipboard API.
Cause
The Image → Paste image action (handleClipboardImage in the plugin's Terminal.tsx) calls navigator.clipboard.read(). The plugin iframes created by the host only get allow="clipboard-write":
http://localhost:30001/plugin-assets/ssh-terminal/_frame/frame.html?role=view&key=... allow=clipboard-write sandbox=allow-scripts
In the DevTools console, in the context of one of these iframes (the operations-center one; the SSH Terminal iframes carry the same allow attribute):
document.featurePolicy.allowsFeature('clipboard-read') // false
document.featurePolicy.allowsFeature('clipboard-write') // true
The desktop app's session handler already grants clipboard-read (CLIPBOARD_PERMISSIONS in the main process), so the block comes from the iframe's permissions policy. In the shipped build, the allow value comes from the plugin SDK UI chunk (dist/frame/assets/shared-termix-ssh-plugin-sdk-ui-*.js), where it is clipboard-write, or undefined on Firefox. I could only read the minified bundle, so I can't point to the source file.
Expected Plugins that declare clipboard access can read the clipboard, or the plugin gets a clear error instead of silence.
Suggested fix
Add clipboard-read to the iframe allow value (clipboard-read; clipboard-write), as the sync plugin's own embedded frame already does.
Workaround Ctrl+V in the terminal.
Notes
- I did not see an error toast within about 2 seconds of clicking, so the failure is silent from the user's side. I did not capture the rejection from the real button; the policy value above is what I measured.
- Not tested on macOS, Linux or the web version.
Auto-triage
Plugin iframes lack clipboard-read permission and the core clipboard shim lacks read() support, causing the SSH Terminal 'Paste image' button to fail silently.
| Field | Value |
|---|---|
| Type | Bug |
| Difficulty | 2/5 (Small) |
| Priority | Medium |
A maintainer will take a look. If anything above looks wrong, just say so.
@pinkfloydFR thanks for the report and the digging. There's a PR for it now: #1954.
Adding clipboard-read to the frame's allow wouldn't be enough on its own. Inside a plugin frame, navigator.clipboard is core's stand-in (src/ui/plugin-frame/shims.ts), which only has readText and writeText, so read() stays undefined either way. Allowing it would also let a plugin frame read the whole clipboard by itself, HTML included. The PR adds read() to the stand-in instead, and the shell does the actual read. Like readText, it only works right after you use that frame, and it hands back only pictures and plain text.
I tested it in Chrome and Safari with the web UI and in the macOS desktop app (on 26.11.2 with the change backported). I haven't tried Windows, so a check there would be welcome if you have time.
This was fixed in v26.12.0. Update Termix to the latest version to get it. Thanks for the report!