Live data from Hacker News

Don't touch my clipboard

alexanderell.is

281–290 of 322 posts

Re: Don't touch my clipboard

#281

Furthermore don't touch my ability to paste into web forms. Some banks do this, and I have no idea why (some incredibly misguided idea of security?). I disabled the ability for websites to disable pasting using Firefox's about:config, but 99.9% of users won't know they can do this.

> I disabled the ability for websites to disable pasting using Firefox's about:config, but 99.9% of users won't know they can do this. Have you encountered any unintended consequences from disabling this?

The consequences of dom.event.clipboardevents.enabled;false mostly results in errors of functionality with WordPress, Google Docs, and Facebook (but I suspect FB has other motivations/reasons for this). You might encounter errors with other WYSIWYG editors, but for the most part, it's a nice optional feature to have control over.

Re: Don't touch my clipboard

#282
post #51

It's not just a browser thing. Apple Books does this with their e-books, which is infuriating if you're working with a coding book and just want to copy-paste stuff into your editor/terminal. You get something like: “ghci> putStrLn (pretty 10 value)” Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books. When you only copied: ghci> putStrLn (pretty 10 value) Note th…

On Windows, clipboard items have hidden tags added when they are copied, so the program you are pasting into can make these decisions, instead of the program you are copying from needing to manipulate the copied text. For example, if I copied that code from a Web page and pasted it into the console it would paste just the code, but if I pasted it into Onenote it would check the tags and add a line underneath with the url the code was copied from.

https://devblogs.microsoft.com/oldnewthing/20140721-00/?p=45...

Re: Don't touch my clipboard

#283

The wrongest thing about this, from my perspective, is that my browser fires off a js 'copy' event when I press control-c. There are times when I've found it helpful that a browser can copy text to my clipboard when I click a button, but I can't think of a single time when I want a site to react to my attempt to copy text off if it. Is there any way to configure my user agent (Firefox) not to do this? A hack is ok.

If you use Greasemonkey or Tampermonkey, you can add the following to run before any other scripts:

    document.addEventListener('copy', 
        function(e){ e.stopImmediatePropagation() }
    );

Re: Don't touch my clipboard

#284

Earlier quoted context omitted.

That's kind of hilarious actually. This highlights the tension between the document-web and the app-web. What if the page is an image editor, word processor, spreadsheet? These app-web pages need custom logic for copy and paste. Unfortunately, bad actors (like what you found) ensure browsers cannot implement this stuff properly, because every feature is now a way to shove a new ad in.

>"the tension between the document-web and the app-web" This is a huge factor in debates about things like the merits of CSS-in-JS, or the tradeoffs in "JAMstack" architecture. Pick any polarizing facet of web development and odds are you'll find this tension at the heart of the opposing perspectives.

And it's not black/white either. It's a spectrum. There are plain HTML documents on one hand, and highly dynamic applications like Figma or Google Sheets on the other hand, but in between are interactive documents and anything you can think of.

So these features are here to stay.

Re: Don't touch my clipboard

#285
post #105

Earlier quoted context omitted.

So yes, I see in your comment that given the context of 'Apple Books' it's probably a contractual issue, I agree there. Though I can see that a reasonable legal opinion might not support my more cynical view, when the risk dynamics are high, a different kind of logic creeps in. I worked for a software platform that refused to provide usable snippets of code anywhere in the documentation for fear of liability. We also…

> Our 'perpetual legal action' was merely cover give the appearance that our brand was being defended, without which action, we could feasibly lose rights to it. Was that really easier than just licensing your trademark with a strong contract that preserved your rights while letting the website use your name for one specific purpose? Make the licensing costs $1 per decade or something if it is a question of money. Mi…

I'm not a lawyer, and I was not involved, other than I knew there was a many-years-long legal action regarding branding against another company with whom we had otherwise a really good relationship.

My point is not about branding or lawyers, it's about risk.

Said company gave up a huge amount of money to patent trolls, and their lawyers were empowered to mitigate risk, with the backing of the CEO, their rationality being: "We make a huge amount of over here, why on earth would we allow that to be risked by speculative activity over there?" which is not entirely irrational, it just depends on implementation.

Everything is so gray, it's so hard to tell. Consider that we have no idea how open-source software licensing will work out because it hasn't been really pushed through the court system, and how limiting that ambiguity is for the entire industry.

Re: Don't touch my clipboard

#286

Earlier quoted context omitted.

Yes, Mac apps have access to the clipboard; that's why they can paste. Is Windows or Linux different? Honest question. Please do not give Apple ideas for a "App would like to access your clipboard" dialog.

What's wrong with the system being push instead of pull? On this key combination (default cmd+V), copy the data stored in this clipboard to the currently active app's own paste buffer, which will then handle inserting the data vs All apps can read and write to the clipboard at all times World readable and writable files that often carry sensitive information sounds like a stupid idea to me.

Because the clipboard is not only accessed with the keyboard. Programs need to be able to access the clipboard so that when the yser presses the "paste" button the application can grab that data and insert it.

Re: Don't touch my clipboard

#287

Earlier quoted context omitted.

Millions of people use applications with these kinds of features. A few more examples: the Scratch educational programming tool, website builders such as Webflow, diagram editors, image editors, etc. The list goes on and on. The browser is no longer just a document viewer... That ship has sailed, and overall it is a good thing. We can mitigate the risk of clipboard hijacking without burning down the house. By the way…

> The browser is no longer just a document viewer... That ship has sailed, and overall it is a good thing. No, it really isn't. Web apps and documents using the same underlying technologies doesn't mean they have to be accessed through a single frontend that provides the worst of both worlds.

> Worst of both worlds

I don't think that is remotely the case.

Re: Don't touch my clipboard

#288

Earlier quoted context omitted.

- This bathtub has a hole in it - Just throw it and the baby away, problem solved

It's not the first time this would be required and done. You probably remember Flash. Once Flash was kicked out Javascript took over it's duties. Only you can't just simply block all JS or expect sites to work without it. JS is worse than Flash now.

I do think some of the ways that js is being abused now are worse than how flash was being abused, but when you get down to it abusive behavior by website owners (and most often, by their marketing departments) is independent of programming languages. It's a business culture problem rather than some flaw in the language design. If everyone stopped using js tomorrow you'd still have people abusing CSS or HTML or the English language to try to undermine or trick people in various ways.

It seems to me that we should be directing our efforts towards better browser/OS design and/or more ethical business practices than in largely futile campaigns to make people give up functionality. I'm reminded of some local activists who campaign tirelessly with posters and graffiti to have people stop driving so as to reduce fossil fuel consumption; even though I agree with them and don't drive myself, just telling people to stop is not very helpful without addressing the question of how to solve the problems that people use vehicles for in the first place.

Re: Don't touch my clipboard

#289
post #51

It's not just a browser thing. Apple Books does this with their e-books, which is infuriating if you're working with a coding book and just want to copy-paste stuff into your editor/terminal. You get something like: “ghci> putStrLn (pretty 10 value)” Excerpt From: Bryan O’Sullivan, John Goerzen, and Donald Bruce Stewart. “Real World Haskell.” Apple Books. When you only copied: ghci> putStrLn (pretty 10 value) Note th…

Wonder if an author will rename themself sudo rm -rf / with the proper escape codes.

A modern shell should prevent you from directly executing pasted code.

Re: Don't touch my clipboard

#290

Earlier quoted context omitted.

What's wrong with the system being push instead of pull? On this key combination (default cmd+V), copy the data stored in this clipboard to the currently active app's own paste buffer, which will then handle inserting the data vs All apps can read and write to the clipboard at all times World readable and writable files that often carry sensitive information sounds like a stupid idea to me.

Because the clipboard is not only accessed with the keyboard. Programs need to be able to access the clipboard so that when the yser presses the "paste" button the application can grab that data and insert it.

The clipboard is a program. Why can the applications that want the data not make an API or file available that the clipboard uses to pass the data into, and then the app does what it will with the data? e.g.

    echo "this is on the clipboard" | cat -
cat doesn't grab anything, it receives via a standard API, both its own and the pipe. Now imagine echo is a clipboard program that exposes no API that cat can use to access data at cat's behest.

Note: As this was informative I hereby declare this a non-useless use of cat.

Post reply on HN