upvote
> As things currently are, I've needed to patch under-fire my PHP, Python, and Ruby applications like 3 times each in the last couple years.

> Conversely, I've had to do zero patches under-fire for the much more complicated rust applications I run.

All those languages are memory-safe, so I'd expect similar failure rates.

As all of those languages are memory-safe, what is your explanation for why Rust applications had fewer CVEs?

reply
A language is only as memory safe as its runtime and external library interop calls. There are many more lines of code written in C executing when running a Python, Ruby, or PHP program than an equivalent Rust program.

Obviously Rust still makes plenty of calls to code that was written in C like libc or the operating system hosting it. But the other 3 do that and have tons of C in their runtime and stdlib on top of it.

reply
Memory safety is just the start.

For instance, it's much harder to end up with a SQL injection in Rust than in PHP. Similarly, the Rust type system is pretty good at modelling advanced protocols, so it's also harder to attack the lower layers.

reply
The large C dependencies of those other languages is a big reason, as someone already mentioned.

But Rust is also type-safe, with an extremely strong type system by mainstream standards. Used well, that’s an enormous benefit for robust and secure systems.

reply
The power of Option<T> and Result<T, E>
reply
I think closed enums might be equally important.

Also I don't understand how better type systems causing fewer CVEs is surprising to anyone.

reply