Live data from Hacker News

Welcome to Comprehensive Rust

google.github.io

71–80 of 204 posts

Re: Welcome to Comprehensive Rust

#71
post #52
post #31

Earlier quoted context omitted.

Since the ultimate objective is to run a binary blob that you just downloaded off of the internet, piping a script to your shell over HTTPS adds no additional attack surface.

Actually no, one can detect curl-piping server-side and serve hostile blobs only to those foolish enough to do so: https://www.idontplaydarts.com/2016/04/detecting-curl-pipe-b...

I'm well aware of that attack, it's quite cute, but if you don't trust the host not to serve you a backdoored binary then you've already lost.

Re: Welcome to Comprehensive Rust

#72
post #67
post #48

Earlier quoted context omitted.

I get what you are trying to say here but I could also make the argument that you actually doubled it because now you have to trust two things rather than one. Depending on how you want to consider trust in a wider sense too it may even be worse than “double” because I do not have the same amount of trust for the package I am ultimately installing and the script I am using to install it. Edit: it’s actually 3 things…

> now you have to trust two things rather than one No, you're still trusting one thing: the host itself. You're downloading both the script and the binary from the host. Both could be backdoored, and of the two, the binary is far easier to hide a backdoor in. As for not trusting curl, you still need to fetch the resource somehow , so you're going to be trusting some tool to do it for you. That's not relevant to incre…

I’m not actually in the Rust ecosystem at all and only just discovered the domain belongs to the official Rust project.

That clearly changes the trust calculation in this scenario.

I had assumed it was some 3rd party project which would have put it in a different category of problems entirely.

But the entire conversation is kind of pointless then. “There is a secret backdoor in the official Rust binary” is not a useful part of any reasonable threat model.

Re: Welcome to Comprehensive Rust

#73
post #63

Earlier quoted context omitted.

On the other hand, I've always found it surprisingly easy to dive into non-trivial rust projects and start contributing, at a speed that would be unthinkable in C or C++. So I second the advise for non-trivial projects, they give a much better idea of the upsides and downsides of rust.

Is that really due to the language or that we collectively have become better in structuring software projects?

You can trust the compiler to yell at you when you break many invariants that would be tacit and implicit in C and even in C++ (even with best practices followed) which can make you much more productive when you’re just familiarizing yourself with a codebase.

Also, the two aren’t necessarily mutually exclusive. Many people learning the language have reported being surprised by the way Rust seems to make "doing things right" the path of least effort, and this applies to best practices in general, not just memory safety.

Re: Welcome to Comprehensive Rust

#74
post #65

Earlier quoted context omitted.

Checking the hash isn't relevant here. The content is served via HTTPS, you either trust the host or you don't. A host can easily serve you a malicious binary, as well as the valid hash of that malicious binary.

Which is why many people choose to only install software from their trusted distro maintainers who add a layer of vetting for random software packages, often built from source so messing with the package isn't possible without leaving some kind of trace that can be detected later.

Indeed, by all means, prefer to trust your distro if they package a version that's new enough. Alternatively, prefer to build from source if you like. But if you trust the Rust project to be competent enough and benign enough not to include malware in the compiler itself, then it's not a stretch to trust their official toolchain juggling tool downloaded from their official website. Focusing on the curl | bash aspect is a tired meme at this point.

Re: Welcome to Comprehensive Rust

#75
post #66
post #31

Earlier quoted context omitted.

Since the ultimate objective is to run a binary blob that you just downloaded off of the internet, piping a script to your shell over HTTPS adds no additional attack surface.

You meant a binary blob in your distro's repository, so one that was checked, tested, approved and verified with a hash. Which is wildly different than downloading and running random binaries or scripts for that matter off the internet.

No, it's hardly random, it's an official binary provided the Rust project from an official domain managed by the Rust project. If you don't trust it, then you shouldn't trust the Rust source code either.

Re: Welcome to Comprehensive Rust

#77
post #39

It's kind of surprising to see that Rust is so rapidly accepted by wide range of developers. Unfortunately I'm from DataScience field, so I cannot see much motivation to learn Rust, but I am considering learning it, because language itself seems exciting! Is there anyone on HN who is from DataScience field like me and has learned Rust? It would be much appreciated if you could share the experience.

We developers love so much to learn computer stuff that we want to do it even when we don't need to.

I worked on data science, computational science, some system engineering and embedded projects. I tried Rust on all of them but it was valuable only for the third.

In data science the focus is more on speed of development and as much as Rust is more enjoyable to use than C++, it doesn't match scripting languages (namely Python) for the flexibility you get, the easiness with which you can adapt to changes and the lack of a need to focus too much on machine-related details. This is the least suited field for Rust between the one I mentioned, in my view.

Computational science needs to focus on algorithms and formulas, Rust can hide them a bit too much under "unwrap"s "iter"s and so on. Plus still no stellar library support and (my) experience with other tools (namely C + OpenMP, Julia, C++, numpy...) made me feel using Rust for that was unnecessary and slower.

When you are designing systems, however, that's where Rust is a complete game changer. Honestly I don't think C++ can stand a chance in its current level. Everything, from the package system, to the borrow checker, to the safe threading model, makes you pity your C++ ancestors for how hard they thought this kind of programming had to be. Rust makes it orders of magnitude more approachable, saner, and with better results too.

Embedded... it's nice but honestly all the dark arts of unsafe Rust are not standardized so it doesn't feel as future-proof as C already.

Re: Welcome to Comprehensive Rust

#78
post #63

Earlier quoted context omitted.

On the other hand, I've always found it surprisingly easy to dive into non-trivial rust projects and start contributing, at a speed that would be unthinkable in C or C++. So I second the advise for non-trivial projects, they give a much better idea of the upsides and downsides of rust.

Is that really due to the language or that we collectively have become better in structuring software projects?

I'm suspicious of this as well. It's common for OSS C and C++ projects (at least in embedded) to be mostly undocumented / few comments, have no easy way to debug by printing to console, and have a complicated build process that requires a certain OS and setup.

Top doc comment: The same license info that's in every file. Not helpful for describing what the module does and how it fits in with the rest of the project.

Re: Welcome to Comprehensive Rust

#79
post #8

The first thing I implore everyone to do when evaluating Rust is to check out a non trivial project and start hacking on it. I have always found the compiler to be unacceptably slow in these cases, especially if you come from C rather than C++. If you work your way up from Hello World you may not ever notice this until you already invested a substantial amount of effort.

Slower compile times are a small price to pay for memory safety and much higher productivity.

You can get memory safety and much faster compile times in many other languages, so that is not a valid argument on its own.

Re: Welcome to Comprehensive Rust

#80
post #69
post #39

It's kind of surprising to see that Rust is so rapidly accepted by wide range of developers. Unfortunately I'm from DataScience field, so I cannot see much motivation to learn Rust, but I am considering learning it, because language itself seems exciting! Is there anyone on HN who is from DataScience field like me and has learned Rust? It would be much appreciated if you could share the experience.

I suppose if you're coming from Python, you could use Rust (with PyO3) instead of C/C++/Cython in something similar to the Numpy/ML lower-level implementations. But I wish there were a language that solved the two-languages problem (fast vs. easy to work with). I find Rust quite verbose.

But I wish there were a language that solved the two-languages problem

That's the whole pitch of Julia.

Post reply on HN