Arbitrary code execution during compilation – rust
1–10 of 58 posts
Re: Arbitrary code execution during compilation – rust
#2Re: Arbitrary code execution during compilation – rust
#3Re: Arbitrary code execution during compilation – rust
#4Re: Arbitrary code execution during compilation – rust
#5Almost all build/project systems I know have this functionality simply because execution of arbitrary programs is too useful to go without. Any C# project (.csproj) for example can include a task that eats your homework.
It’s scary but I don’t see a solution like sandboxing being very easy to retrofit either.
Re: Arbitrary code execution during compilation – rust
#6Don't most editors ask you whether or not you want to trust some code before opening it with full privileges anyway?
Re: Arbitrary code execution during compilation – rust
#7See NPM installations and "please sponsor this project" messages, which can also give you a virus.
Re: Arbitrary code execution during compilation – rust
#8I would expect any sufficiently powerful macro system would have to be this way. Don't most editors ask you whether or not you want to trust some code before opening it with full privileges anyway?
Re: Arbitrary code execution during compilation – rust
#9I filed a issue on `rust-analyzer` and apparently it is by design - https://github.com/rust-lang/rust-analyzer/issues/14375
There was talk about trying to compile proc macros to WASM and run them sandboxed in the compiler. Not sure what happened to that RFC (by dtolnay?)
Re: Arbitrary code execution during compilation – rust
#10Afaik you don’t even need to use macros for this, can’t you just put a build.rs file in the crate and it will execute on build? Almost all build/project systems I know have this functionality simply because execution of arbitrary programs is too useful to go without. Any C# project (.csproj) for example can include a task that eats your homework. It’s scary but I don’t see a solution like sandboxing being very easy t…
I want the build process to be able to generate arbitrary code based on the inputs given to it from the source control — but nothing else. No reaching out to HTTP command and control endpoints, making database calls, or deleting my home directory.
It’s not just because of security. Security is a side-benefit here.
The real benefit is that unrestricted build processes cannot be versioned with source control. If the build process can “reach out” and pull in data from external sources, then it will always use the “latest” version, not the version in that branch or commit.
It’s about being hygienic.