4 ms·
I thought sandstorm was supposed to be a security-focused project? But they're writing new C code and connecting it to the Internet. And surprise surprise, this
by lmm 10y ago
I thought sandstorm was supposed to be a security-focused project? But they're writing new C code and connecting it to the Internet. And surprise surprise, this happens.
Fuzzers will catch a certain proportion of this type of problem, sure. But for a ground-up project like this there's really no excuse not to use a better language.
- _pmf_ 10y agoI'm usually not in the No-C camp, but your argument (new software with focus on secure infrastructure) is actually solid.
- detaro 10y agoThere is also a Rust implementation, which is the one Sandstorm uses as far as I know.
- staticassertion 10y agoIs there a source for this? I was unaware.
- steveklabnik 10y agohttps://github.com/dwrensha/capnproto-rust https://github.com/dwrensha/capnproto-rust
- staticassertion 10y agoThanks, this is what I was looking for (found through your link): https://github.com/sandstorm-io/collections-app https://github.com/sandstorm-io/collections-app So it does seem to be the case that they are using the rust version here. That's nice.
- kentonv 10y agoDynamic languages are susceptible to their own kind of security bugs. I've found lots of bugs in Node apps where they accepted some JSON from the client and then passed it directly into a Mongo query without type-checking it. Or look at Ruby's YAML security issues. Nearly every language is vulnerable to integer overflow. C++ is one of the few languages (possibly the only popular language) where you can reasonably check for overflows at compile time, as Cap'n Proto now does: https://capnproto.org/news/2015-03-02-security-advisory-and-integer-overflow-protection.html https://capnproto.org/news/2015-03-02-security-advisory-and-... So, I don't accept the assertion that C++ is inherently a security problem. In any case, Sandstorm's low-level container management bits pretty much had to be written in C/C++ since they interact closely with the operating system. Or if we were starting over today, Rust might now be an option, but it wasn't when we started.
- nickpsecurity 10y agoOr Ada 2012 + SPARK 2014 wrapping the C API behind safer interfaces. One can catch most problems, including integer overflow, at compile time or with runtime checks it inserts. The other can prove their absence automatically in more static code. Rust can prevent temporal errors at compile time so it's on table, too.
- lmm 10y ago> Dynamic languages are susceptible to their own kind of security bugs. I've found lots of bugs in Node apps where they accepted some JSON from the client and then passed it directly into a Mongo query without type-checking it. Or look at Ruby's YAML security issues. I don't advocate dynamic languages. Indeed I regard this class of vulnerabilities as evidence of a lack of type safety. Still, C++'s undefined behaviour semantics promote almost all bugs into security bugs, which is not a great property to have in your language. > C++ is one of the few languages (possibly the only popular language) where you can reasonably check for overflows at compile time, as Cap'n Proto now does: https://capnproto.org/news/2015-03-02-security-advisory-and-.. https://capnproto.org/news/2015-03-02-security-advisory-and-.... C++ using that kind of template metaprogramming technique has nowhere near the overall popularity of C++, so that's not really a popular approach either (in the sense that e.g. few tools understand it, people who can work on it are hard to hire...). And any language with a reasonably advanced type system (or macros) could do the same thing.
- blub 10y agoOne doesn't need to use complex template techniques, a class like CSafeInt should cover all integer overflow bugs with run-time checks. The problem is that almost no one is thinking about this class of bugs. Furthermore, few languages offer tools to detect and handle integer overflows; I read that Rust for example only has run-time checks in the debug version, which to me is disappointing.
- kouteiheika 10y ago> I read that Rust for example only has run-time checks in the debug version, which to me is disappointing. Only by default; you can turn them on in release builds too if you want. (And Rust 1.17 will have a stable `-C overflow-checks=y` flag which allows you to turn on the overflow checks without other debug assertions.)