4 ms·
Funny to see this. Just yesterday, I copied some selected text from a browser, and pasted into a terminal - big mistake. The clipboard contained junk (basicall
by lioeters 6y ago
Funny to see this. Just yesterday, I copied some selected text from a browser, and pasted into a terminal - big mistake.
The clipboard contained junk (basically advertising) with numerous new lines. Fortunately, none of it did anything, but it was a good learning experience that I cannot trust the browser to copy the selected text as is.
The very annoying thing was that the text was copied from a website with code snippets, in this specific case, some terminal commands to run. And they hijacked the clipboard so the commands are corrupted when copied and pasted. That's so asinine..
Allowing client-side JavaScript to alter clipboard content like this is a security vulnerability. What if a page suggested copying and pasting some text in a terminal, then replaced the clipboard contents with arbitrary commands.
I can imagine some exceptions, like "Copy to clipboard" functionality, but there's gotta be a reasonable solution.
Now that I know about this vulnerability, I have to copy & paste anything into an editor first, to make sure that it's what I actually selected and copied.