Open
Description
The glibc manual at https://www.gnu.org/software/libc/manual/html_node/Environment-Access.html#Environment-Access says:
Libraries should use secure_getenv instead of getenv, so that they do not accidentally use untrusted environment variables.
libstd is a library, and many (most?) Rust crates are libraries, so it seems like we either should follow glibc's advice and use secure_getenv
, or we should document a clear rationale for going against its advice.
See
rust/library/std/src/sys/unix/os.rs
Line 533 in 1d71ba8
musl 1.1.24+ and glibc 2.17+ both support secure_getenv
so I suggest we just assume any libc on Linux has it.