4 ms·
With rust quite often (e.g. if you are running rust_analyzer) it will run `cargo check`, to produce errors. When `cargo check` is run, build.rs compiled and run
by ratmice 4y ago
With rust quite often (e.g. if you are running rust_analyzer) it will run `cargo check`, to produce errors. When `cargo check` is run, build.rs compiled and run.
So quite often by step 1, just opening the file in your editor before even
making any changes code is compiled and run.
Walter's solution here allows the compiler to be used by the editor without
the editor being susceptible. Which at the very least negates the need for a pop-up in your editor asking for permission.
- iudqnolq 4y ago> With rust quite often ... it will run `cargo check` Yup. But making "cargo check" safe while "cargo run" stays vulnerable just reduces the number of times you run malicious code. And whether malicious code runs on my laptop every time I edit a file or every hour or every week makes absolutely no difference. One run and the malware can persist and run whenever it wants going forwards. > Which at the very least negates the need for a pop-up in your editor asking for permission. My argument is that the pop-up is security theater. I've disabled it, I don't think it should be enabled by default. [1]: I'm handwaving slightly to get from "your code depends on a malicious library" to "malicious code is run". If I recall correctly there's linker tricks that could do that, or you could just have every entrypoint call some innocuous sounding setup function that runs the malicious code.
- ratmice 4y agoonly if you intend to run the program though, if you want to just read the source code, perhaps to see if it contains malicious code you really don't want your editor doing such things by default, so something has to give.