News for hackers. Stuff that matters.
Re:PL/Rust 1.0: now a trusted language for Postgres by IshKebab on Sunday April 09, 2023 @01:22PM (#35504654)
I don't think it's really any defence at all against an attacker. I don't think Rust's `unsafe` was ever intended to be a security boundary.

Surely all a "sufficiently motivated" attacker would need to do is peruse the unsound bugs on GitHub?

https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Ais...

Those aren't considered to be security issues. Makes me wonder what the point of banning `unsafe` is at all. You're going to need some other system anyway...

Re:PL/Rust 1.0: now a trusted language for Postgres by feike on Sunday April 09, 2023 @04:06PM (#35505976)
The trust is not just banning unsafe, it is using a limited std:

> The "trusted" version of PL/Rust uses a unique fork of Rust's std entitled postgrestd when compiling LANGUAGE plrust user functions.

https://github.com/tcdi/postgrestd

Re:PL/Rust 1.0: now a trusted language for Postgres by IshKebab on Monday April 10, 2023 @03:48AM (#35510068)
That doesn't matter. If you can use `unsafe` you can make syscalls directly.
Re:PL/Rust 1.0: now a trusted language for Postgres by ekimekim on Monday April 10, 2023 @10:22AM (#35512674)
A large number of unsoundness bugs only work if you have access to the stdlib, because they're flaws in stdlib types and functions that use `unsafe` internally, and are supposed to present a safe interface around it.

If you a) don't have access to unsafe, and b) don't have access to the stdlib that lets you do powerful things without unsafe, then you're very limited in what you can do.

https://smallcultfollowing.com/babysteps/blog/2016/10/02/obs... discusses this further. Conceptually, you can think of "entirely Safe Rust" to be a very limited language, which you then progressively add "capabilites" to by exposing safe interfaces implemented with unsafe code. For example, Vec and Box (which require unsafe) grant safe code the ability to do heap allocations.

It's true that this is not designed as a security boundary. As I note in my comment above, the PL/Rust devs also make that clear. That doesn't mean it has no value as part of a defence in depth strategy.

Re:PL/Rust 1.0: now a trusted language for Postgres by workingjubilee on Monday April 10, 2023 @10:12PM (#35519876)
The rustc driver for trusted PL/Rust prevents using the subset of the Rust language required to trigger those issues. Most of them are things that would have a hard time traversing the Postgres procedure call boundary, anyways, in a legitimate use-case, so this isn't expected to meaningfully affect actual user code.