-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Command::env
doesn't report an error for keys with =
in them
#122335
Comments
It should be analogous to libc's I think that it should be considered a bug, the windows impl should have the same issue (not tested) because no check is made on name (like for unix), and for |
It's undocumented but |
I assume that acts like a dotfile then, where you have the full envar be |
Parsing is done simply by making sure the key name is at least one character. So rust/library/std/src/sys/pal/windows/os.rs Lines 148 to 153 in 6e1f7b5
So in relation to the OP we'd just skip over the first character when disallowing |
@rustbot claim |
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Validate environment variable names in `std::process` Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Validate environment variable names in `std::process` Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335. try-job: x86_64-msvc
Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335.
Validate environment variable names in `std::process` Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335. try-job: x86_64-msvc
Validate environment variable names in `std::process` Make sure that they're not empty and do not contain `=` signs beyond the first character. This prevents environment variable injection, because previously, setting the `PATH=/opt:` variable to `foobar` would lead to the `PATH` variable being overridden. Fixes rust-lang#122335. try-job: x86_64-msvc
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4c8d4bb6d9fb790591d7cf07dbf516e8
This has a stdout of
bar=baz
, so thefoo
key has valuebar=baz
.Which isn't what I asked for in
env
, but what I asked for is invalid.We probably shouldn't panic from a bad
env
call, but this program shouldn't be able tospawn
without erroring.I assume
.env("foo=bar", "baz").env_remove("foo=bar")
shouldn't error. (Also, not sure how non-unix platforms handle this, but this validation should presumably be platform-specific).I'm not sure if this is a bug or just weird behavior.
The text was updated successfully, but these errors were encountered: