-
Notifications
You must be signed in to change notification settings - Fork 892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Environment variable to disable rust-toolchain.toml
#2793
Comments
I'd phrase this more general terms. We need an env variable that indicates that the contents of the file-system is "untrusted". So that, if we set
|
I agree that a more general solution is better. There's a number of possible approaches here. The approaches outlined so far are good, an alternative is a more explicit approach. Here's a starter-for-ten on that kind of approach: Any UX would be approximately:
The trusting/overrides would not be stored in the dir, but rather in What do people feel about that as an approach? |
That will break CI as there is no user to approve the |
Yeah, that's much better, provided that we don't actually break real-world CIs. I guess that's ok, if the logic triggers only for path-based overrides. I think it's OK, and probably better, if rustup downloads official toolchains without questions. From the tooling perspective, we probably need a special exit code (451 ?) to distinguish this specific failure, so that, eg, an IDE can show a dialog to for the user. cc @Undin, @vlad20012 |
So CI could run If we choose to only require it for path based toolchains then that might help a bit with the usability. Rustup will try and download official toolchains (and add components/targets) by default if it needs to. A special exit code for this makes sense, frankly I'd like to overhaul our exit code strategy entirely at some point. To ease UX in situations where there are lots of projects (e.g. someone's company uses a custom toolchain) the That way CI could Thanks for the Opinions? @bjorn3 would that satisfy you? |
👍 This pretty much mitigates the usability and CI impact of requiring a trust command.
💖 |
Hypothetical: if there is, say, an arbitrary code execution bug (or another security bug) in |
@lnicola True, though there's an argument that any such toolchain should probably have its channel file yanked from static.rust-lang.org no? |
That depends. If it's a long-standing bug (introduced in 1.10, found today), that would be impractical. |
In that case we probably need a toolchain status file on static.rlo which rustup can read to understand if there are toolchains with security problems and/or known major regressions. Then rustup could refuse to install a flagged official toolchain unless it was also marked as trusted by the user. |
I'm sorry to come in late, but I don't see the attack vector here. toolchains are local machine configuration - write access to CARGO_HOME is required, or the ability to set RUSTUP_HOME= If one has write access to CARGO_HOME, arbitrary code execution is possible by replacing the cargo registry. You could make a case for defense in depth, but I'd like to understand the threat model a bit better: what is untrusted here, and what defines the trust boundaries? |
Argh, sorry for the noise, my brain had forgotten the [path] option in toolchain files. I somewhat regret us adding that. That said, I think we should write up the threat model as part of fixing this - to be crystal clear what expectations we're putting on future us. I think an env variable is potentially risky in terms of chained attacks - if someone finds a env variable setting gadget (say for instance that some IDE blacklists known risky variables rather than whitelisting safe ones... and misses RUSTUP_*) then we've opened the door to numerous bypasses (set RUSTUP_TOOLCHAIN directly for instance). |
Looks like we now have a clear path towards this:
|
Describe the problem you are trying to solve
In order to support VS Code's "workspace trust" feature in rust-analyzer (rust-lang/rust-analyzer#9224), we'd like to disable
rust-toolchain.toml
support, since that allows arbitrary code execution.Describe the solution you'd like
The easiest solution would be some environment variable that simply disables this toolchain file, but I'm open to alternatives.
The text was updated successfully, but these errors were encountered: