4 ms·
Here's a stab at defining a function: The clipboard should act at an only at user direction to copy content from one application or context to another. The cl
by dredmorbius 7y ago
Here's a stab at defining a function:
The clipboard should act at an only at user direction to copy content from one application or context to another.
The clipboard should not, nor should applications be able to, alter the copied content from the visibly-selected content.
Applications, other than when clearly and unambiguously directed by the user be able to access or read clipboard contents.
I'd suggest additionally that it should be possible to examine and edit within the clipboard context itself what was copied.
This creates a few obvious issues, one of which is that commandline and programmatic tools for interacting with the clipboard ... won't function as transparently as they do now. A fact which would affect me directly as I make heavy use of these (xclip in Linux, pbcopy / pbpaste in MacOS, termux-clipboard-set and termux-clipboard-get in Termux/Android). I think I'd be reasonably comfortable with a confirmation dialog appearing in such cases, or having those applications specifically exempted (convenient, though some risk).
The problem of programmatic interfaces to the clipboard is another matter, and those are ... probably a complex issue.
Note that when working entirely within the shell, the issue largely disappears as the inter-process commmunications method is largely pipelines, files, or the shell environment (variables) themselves. With some exceptions, such as gpm(8) (a cut-and-paste utility and mouse server for virtual consols, in Linux).
Though there's also behaviour of the X11/Xorg or Wayland clipboards.
- alkonaut 7y ago> The clipboard should not, nor should applications be able to, alter the copied content from the visibly-selected content. This might feel intuitively right, but it severly limits the usefulness of the clipboard. It then becomes a basic plain text clipboard Try opening an rich text editor (e.g. https://quilljs.com/playground/ https://quilljs.com/playground/) and selecting two words of which one is bold. Hit Ctrl+C. What is now on the clipboard? What happens when you paste? You have your formatting preserved. The editor has intercepted the copy command and stored data only it knows how to create and parse. The same would happen in a diagram editor (a selected shape would perhaps be stored as some json representation), or an image editor. The problem is that the clipboard as an established concept already means "area where programs write their custom formatted data and where any app can read the same data upon paste". Restricting it might be a good idea in some cases, but it's the user expectation so it's what apps (including browsers) need to do as the default. This unfortunately means that abusing it as in the article will be possible. There is no way for the browser to know whether the changed content was formatting tags (good) or trashing the selection by adding a copyright (bad).
- dredmorbius 7y agoIf you want to pass rich text or spreadsheet cell formulae, display those before selecting. Which puts the onus on the application to provide that functionality. That preserves the functionality, respects the "copy visibly-selected content" directive, and makes clear just what is being saved to the clipboard, making sneak attacks more difficult. Argument that the clipboard behaves in a way that is demonstrably prone to malicious attack is simply argument from tradition. Yes, that's how things have been done. We're discovering that how things have been done leads to strongly negative consequences.
- alkonaut 7y agoNot sure I follow, how should the argument display the rich text (markup/formatting instructions) before the selection? The displayed/selected content might be Foo Bar but the content I want on the clipboard could be Foo <i>Bar</i> but I never want to see the markup, only the formatted text. I don’t want to make a two step function where I need to reveal a textual description of the content and select that. The markup might be a base64 encoded piece of binary gibberish in the case of a visual diagram for example.
- dredmorbius 7y agoThat would be unsupported functionality. You cannot both have transparent copy capability and copy hidden content without revealing it. Copying visual content would be subject to different requirements and limitations. But for text: what you see is what you get. If you're copying glyphs alone, those are what are copied. If you want formatting, you'll need to have the source application reveal that.
- alkonaut 7y agoIt could be an option that is revealed after a warning. "This page wants to use the javascript 'copy' event to place transformed data on the clipboard. If you accept it would place [data shown] on the clipboard, otherwise it would place [raw text] on the clipboard". What do you want to do? copy text? copy data? [ ]remember my choice for this site. Here, data shown would probably be some info about the data rather than the data itself. It could be a 2mb base64 bitmap... However, perhaps a better alternative would be to offer both "copy text" and "copy" where the former just copies selected glyphs as plaintext while copy fires the js event allowing the transform. The important thing to remember is that webpages in 2020 must work like users expect desktop applications to work, and interact with desktop applications (e.g. copy rich content from webpage to desktop must be a default enabled feature or the user will consider the browser broken). For this reason, I don't think it's a viable solution to disable the js event by default (i.e. to hook Ctrl+C to the "copy text" function).
- mattkrause 7y agoThat’s a good start, but it’s tricky. How are you going to distinguish between user and programmatically-initated actions? Adding something like a “Secure Copy Key”, akin to control-alt-delete in Windows might work, but it’ll need kernel-level support. Determining whether the clipboard contents faithfully represent the “visibly-selected” content is also very hard, possibly AI-hard. Suppose I copy an image while zoomed? What size should the clipboard contents be: the original size it’s apparent size? One mitigation, if you’re worried about this now, might be to run certain programs as another user. I don’t think the clipboard is shared then.
- dredmorbius 7y agoHow are you going to distinguish between user and programmatically-initated actions? That is a deep and fundamental problem within any mediate technology. It's not trivial. The simple answer is "look for indications from standard user inputs". But those inputs (keyboard, mouse, touchscreen) are themselves sufficiently complex that they can be mimicked, intercepted, or spoofed. There is the problem of distinguishing legitimate from counterfeit confirmation dialogues (already a persistent attack vector for desktop and mobile device users). There is the problem of rogue devices communicating over USB or Bluetooth connections (an argument for a principle of minimum necessary capability for interface ports -- serial and PS/2 connectors have their justifications), though that usually entails other devices being silently added to a system. Though a USB device spoofing an additional keyboard or mouse is also a demonstrated attack. All of which starts drifting focus away from the key point: what is an unambiguous expression of user intent, and how would you go about ensuring that this is determinable? The determination of contents question gets to a somewhat different matter: what kind of data are being copied? I'll admit that I was thinking of the case of text, though there is also image, and conceivably audio and video data. For text, zoom is irrelevant as that's a display artefact and (at least as I envision it) the goal is to copy the text as displayed, independent of typographical formatting, rather than "glyphs of some size and presentation". Multi-user clipboard access is dependent on the graphical environment. For X11/Xorg, applications regardless of effective userID, have access to the clipboard. (X11 also had some early attempts at securing the clipboard, with varying degrees of success. Issues such as grabbing keyboard input, potentially silently, were also an early concern.)