News for hackers. Stuff that matters.
Re:Curl to shell isn't so bad by brianpgordon on Saturday November 09, 2019 @08:56AM (#21491547)
It seems like you're assuming that there's someone vetting these packages. For enterprise distros like Red Hat that's certainly true. Community package maintainers in, for example, the Debian project provide some safety as well. But there are plenty of package managers where that's just not the case. In the case of Homebrew, the package manager pulls down the program directly from upstream and installs it. It's exactly the same as downloading a tar file from the developer's website over HTTPS. Same with npm. Some package managers like Maven and NuGet will rehost artifacts but if the project owner is malicious or compromised then that won't help - so the risk profile is again basically the same as downloading a tar file from the website.
Re:Curl to shell isn't so bad by jsjohnst on Saturday November 09, 2019 @01:44PM (#21493375)
> In the case of Homebrew, the package manager pulls down the program directly from upstream and installs it.

Sure, in the most basic case it does this, but even in the most basic case it does more than that. At minimum it also verified the download matches a known good hash.

The important part (to me) is that Homebrew also ensures the package installed conforms to Homebrew’s standard. There’s a lot of standards (install in /usr, /usr/local, /opt, etc) on something as simple as where the files are put, let alone how it’s built and it’s dependencies are pulled in.

So to say there’s no value in installing from Homebrew over curl|sh is clearly misguided IMHO.

Re:Curl to shell isn't so bad by lloydde on Saturday November 09, 2019 @02:18PM (#21493635)
Homebrew is only as secure as the results of that first curl command

     /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
I get why https://docs.brew.sh/Installation doesn’t discuss the versioning or security practices. It is interesting that homebrew doesn’t seem to interface with macOS’s signing and installation practices.

Reminds me that there is still no official package manager on macOS. So https://nodejs.org/en/download/ has you comparing check sums.

Re:Curl to shell isn't so bad by jsjohnst on Saturday November 09, 2019 @02:51PM (#21493847)
1. Using curl|sh isn’t the only way to install Homebrew

2. Most of my post wasn’t addressing security, but actual real usability gains by using Homebrew.

Re:Curl to shell isn't so bad by brianpgordon on Sunday November 10, 2019 @11:43AM (#21498717)
How exactly is the file going to get tampered with if you're using curl-to-sh? Everyone uses HTTPS nowadays. Validating the hash is not really doing anything significant.

As for ensuring that the package is well-behaved, could you elaborate on that? I'm not aware of Homebrew doing something like chrooting to /usr/local before running the install script. And the install script can do anything as your local user, same as curl-to-sh. Perhaps the Homebrew maintainers would catch something nefarious in the formula itself, but given that most formulas download code from the Internet and run it, that's not much help.

Re:Curl to shell isn't so bad by jsjohnst on Sunday November 10, 2019 @06:43PM (#21500957)
> Validating the hash is not really doing anything significant.

Yes it is, it’s ensuring that what the maintainer of the formula verified is still what’s being downloaded now. HTTPS does nothing to protect someone modifying the source URL, but the hash does that (assuming the maintainer actually inspected the initial download, which many if not most do).

> but given that most formulas download code from the Internet and run it, that's not much help.

1) the previously erroneously dismissed hash helps there.

2) the sandbox which you linked to later also helps too.

Re:Curl to shell isn't so bad by brianpgordon on Monday November 11, 2019 @10:11AM (#21505411)
I suppose it comes down to whether the Homebrew maintainer who accepts the formula PR containing the hash is actually examining the upstream code in detail. I think that is unlikely; there's too much code for Homebrew maintainers to be experts on everything contained in homebrew-core and follow every single patch.

So yes, the hash prevents the upstream project from switching out the code at any time, but if they wanted to add some malicious code all they have to do is file a homebrew-core PR and hide it in a legitimate change.

Re:Curl to shell isn't so bad by jsjohnst on Monday November 11, 2019 @06:39PM (#21510117)
> I think that is unlikely; there's too much code for Homebrew maintainers to be experts on everything contained in homebrew-core and follow every single patch.

By that logic, everything in any package manager should be treated with distrust then. Debian, RHEL, Arch, etc etc.

Not saying I disagree with distrusting, just making the point that risk exists everywhere, at some point you have to decide what you’re comfortable with.

Re:Curl to shell isn't so bad by brianpgordon on Wednesday November 13, 2019 @05:50AM (#21522759)
To some extent, sure, but I think that extent is greater with Homebrew. It's my understanding that package maintainers for Debian, RHEL, etc are typically experts in the packages that they maintain. They overlay their own patches to ensure compatibility and submit patches upstream. With Homebrew there's only a small number of committers who maintain the homebrew-core repository, accepting PRs from thousands of people in the community. It's just a different situation.
Re:Curl to shell isn't so bad by jsjohnst on Thursday November 14, 2019 @11:11PM (#21542144)
> It's my understanding that package maintainers for Debian, RHEL, etc are typically experts in the packages that they maintain.

That’s certainly true in some cases, but is definitely not the case in the majority. I think you are letting your personal biases color your judgement to much.

Re:Curl to shell isn't so bad by dickeytk on Sunday November 10, 2019 @12:47PM (#21499117)
They do chroot. You can only install to specific directories
Re:Curl to shell isn't so bad by brianpgordon on Sunday November 10, 2019 @03:06PM (#21499875)
Ah, I found it. On MacOS they rely on sandbox-exec which uses the sandboxing mechanism provided by the kernel:

https://github.com/Homebrew/brew/blob/e2c76cce8e01fd80e0910d...

https://github.com/Homebrew/brew/blob/master/Library/Homebre...

Re:Curl to shell isn't so bad by theamk on Saturday November 09, 2019 @04:52PM (#21494639)
Many package managers provide a real audit trail, and this (IMHO) is very valuable. For example, in python's PIP (and apparently in NPM too), the filenames are never reused:

https://github.com/pypa/packaging-problems/issues/74

Developer's website may change at any time, and even go back-and-forth between good and bad version. The pip software version won't. Put a version pin, and you can be sure you get a good package or an clear error.

Granted, you can record/verify the checksum of downloaded files as well, but many people don't. And crazy practices like 'curl | sh' make that impossible anyway.

Re:Curl to shell isn't so bad by paulddraper on Saturday November 09, 2019 @11:17AM (#21492334)
npm removes malware when reported.
Re:Curl to shell isn't so bad by acdha on Saturday November 09, 2019 @11:47AM (#21492544)
Which is repeating that sources matter: curl from a source like Github with a solid abuse process is a very different story than an unknown server.
Re:Curl to shell isn't so bad by mceachen on Saturday November 09, 2019 @11:42AM (#21492517)
s/when/if/

Fixed that for you.

Re:Curl to shell isn't so bad by paulddraper on Saturday November 09, 2019 @03:17PM (#21494052)
I don't believe that changes the meaning.
Re:Curl to shell isn't so bad by mceachen on Sunday November 10, 2019 @11:17PM (#21502114)
(sorry, it was an obscure inverted reference to the saying "not if, but when")