Live data from Hacker News

Don't Copy-Paste from Website to Terminal

thejh.net

81–90 of 272 posts

Re: Don't Copy-Paste from Website to Terminal

#81
post #59

Why would I bother copying and pasting the code to my clipboard when common industry practice now is just to invoke the output of curl directly? ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go )

C'mon... That is nothing like the industry standard -- you used SSL.

Watch out. Does curl check the key chain against any key store? I bet not.

Re: Don't Copy-Paste from Website to Terminal

#83
post #43

I'm confused why this is even allowed by the browsers, you shouldn't be able to send something else to the clipboard. Are there any browser extensions that can 'fix' this issue?

There is a good use case for this. For example, if you copy a link from Twitter, you instead get the shortened URL so you're protected from malware when you click through:

https://twitter.com/sampullara/status/320695597894098944

Re: Don't Copy-Paste from Website to Terminal

#84
post #78

Why would I bother copying and pasting the code to my clipboard when common industry practice now is just to invoke the output of curl directly? ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go )

Why would you say that is industry practice when it is not?

It's the suggested install for homebrew. http://mxcl.github.io/homebrew/

Re: Don't Copy-Paste from Website to Terminal

#85

Why would I bother copying and pasting the code to my clipboard when common industry practice now is just to invoke the output of curl directly? ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go )

I was quite surprised when this was the normal way of installing rvm:

https://rvm.io/rvm/install/

Re: Don't Copy-Paste from Website to Terminal

#86
post #14
post #7

Nicely done! Here's the underlying source: git clone /dev/null; clear; echo -n "Hello ";whoami|tr -d '\n';echo -e '!\nThat was a bad idea. Don'"'"'t copy code from websites you don'"'"'t trust! Here'"'"'s the first line of your /etc/passwd: ';head -n1 /etc/passwd git clone git://git.kernel.org/pub/scm/utils/kup/kup.git

I was expecting it to be done with Javascript, which is, afaik, how the horrible websites that tack a URL and a "this quote came from blah" attribution, work. I hate all of this stuff and it is greatly saddening that browser vendors are not protecting us from it. It's like the pop-up-on-click days of old and it must stop. If I select some text and copy it, I am taking a very explicit action. I am giving the computer…

>If I select some text and copy it, I am taking a very explicit action. I am giving the computer a very explicit instruction. There is no room for interpretation. It must not disobey me!

From the point of view of the browser, it very explicitly does what you told it to, without interpretation, obediently. The problem is that yours and the browser's opinions differ on what you intended to do.

Re: Don't Copy-Paste from Website to Terminal

#87

Why would I bother copying and pasting the code to my clipboard when common industry practice now is just to invoke the output of curl directly? ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go )

one of the recommended ways to install oh-my-zsh

   wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

Re: Don't Copy-Paste from Website to Terminal

#88

Why would I bother copying and pasting the code to my clipboard when common industry practice now is just to invoke the output of curl directly? ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go )

Are you going to type that string into your terminal manually, or are you just copy/pasting that line from a web page, still leaving yourself open to this issue?

I find it hard to believe anyone will be reading that line on a web page, then typing it out correctly in their own terminal instead of just saying, "ok that line looks fine copy paste"

Re: Don't Copy-Paste from Website to Terminal

#90

This is really just an extension of clickjacking - modifying the UI to trick the user into performing an undesired action. This is a pretty novel idea, and considering how many websites make use of this to slap their permalinks into copied text (albeit with flash, usually), I'm surprised this hasn't been thought of before. It would be an interesting experiment to sneak a harmless command after every snippet on a site…

Even if the shell had such protection, they could just do 'evil command && visible command'.

If the shell had a protection against text pasted together with an ending newline (and would just strip that newline), it would help, I think.
Post reply on HN