Live data from Hacker News

Don't copy paste from a website to a terminal

thejh.net

21–30 of 257 posts

Re: Don't copy paste from a website to a terminal

#24
post #12

At the end of the day we have to have trust in others especially in opensource. Everything you incorporate in your apps/sites could be malicious.

Why especially in open source? The leap of faith is larger with a binary blob. (Although I admit it doesn't make much difference in practice, most people don't audit source code).

Re: Don't copy paste from a website to a terminal

#25
If you bother to compose half a page on a software problem, might as well provide a solution, no?

  runCb(){ cb; echo -e '\n\nGo on? (y/n)'; read -sn 1 ans; if [ "$ans" = y ]; then eval "`cb`"; else true; fi; } #cb should output the contents of your clipboard
Or another option would be to switch your terminal to editing mode (v in the normal mode of `set -o vi`), paste it there, and do `:wq` to run it.

Re: Don't copy paste from a website to a terminal

#26
post #2

The problem is that there's a lot of software out there that expects you to install it this way - particularly by piping into sh or bash or the like. See also http://www.seancassidy.me/dont-pipe-to-your-shell.html and http://output.chrissnell.com/post/69023793377/stop-piping-cu... and https://www.chef.io/blog/2015/07/16/5-ways-to-deal-with-the-... . There was also a blog out there collecting instances of this, but I…

I ran into this for the first time just recently when installing ruby and was very surprised and hesitant to follow the instructions ( see here https://www.digitalocean.com/community/tutorials/how-to-inst... ). Glad to see people speaking out against it.

Re: Don't copy paste from a website to a terminal

#27
post #4

A good terminal should show you the full pasted text in a confirmation popup before executing it. Also should never accept new lines from a paste. Or rather; if and when the paste contains new lines, it should show a confirmation popup so you know what the hell you're executing.

Something like windows? It should treat any newline signs in the pasted text as starts of new lines, not as "enter command". The person would need to press enter after pasting.

Re: Don't copy paste from a website to a terminal

#29
post #2

The problem is that there's a lot of software out there that expects you to install it this way - particularly by piping into sh or bash or the like. See also http://www.seancassidy.me/dont-pipe-to-your-shell.html and http://output.chrissnell.com/post/69023793377/stop-piping-cu... and https://www.chef.io/blog/2015/07/16/5-ways-to-deal-with-the-... . There was also a blog out there collecting instances of this, but I…

One example: http://curlpipesh.tumblr.com/

Re: Don't copy paste from a website to a terminal

#30

Is there some firefox addon that will prevent websites from changing what I copy?

It's not changing what you copy, rather when you highlight that, it's also selecting text that you can't see because it's been positioned outside of the viewport.
Post reply on HN