Huginn/crates/mind-body/clippy.toml
Meta Vens 47d9a35fcd mind-body: the process environment is unreadable by library code, by lint
clippy.toml lists the std::env readers (var, var_os, vars, vars_os,
set_var, remove_var, args, args_os, current_exe, temp_dir, home_dir) and
libc::getenv as disallowed methods, and lib.rs forbids allowing them back.
main.rs and the self-spawning integration test carry the only allows.
The forge probe's environment sweep and its 22 guessed variable names go:
the lint covers a variable of any name, so the list was a second, weaker
path for the same rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 20:15:18 +02:00

21 lines
2 KiB
TOML

# The brake's root is a constant: no function, argument, variable or flag lets a
# caller choose it (control.rs). The strongest form of "no variable" is that no
# code in this crate can read the process's environment at all, whatever name it
# would read, so the rule is a lint on the readers and not a list of names.
# `#![forbid(clippy::disallowed_methods)]` in lib.rs keeps the library from
# allowing them back; the binary (main.rs) and the one integration test that
# spawns itself (tests/control.rs) carry the only allows, each with its reason.
disallowed-methods = [
{ path = "std::env::var", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
{ path = "std::env::var_os", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
{ path = "std::env::vars", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
{ path = "std::env::vars_os", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
{ path = "std::env::set_var", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
{ path = "std::env::remove_var", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
{ path = "std::env::args", reason = "the command line is caller-chosen input; only main.rs reads it" },
{ path = "std::env::args_os", reason = "the command line is caller-chosen input; only main.rs reads it" },
{ path = "std::env::current_exe", reason = "the executable's location is caller-chosen; the brake's root is CONTROL_ROOT" },
{ path = "std::env::temp_dir", reason = "reads TMPDIR; the brake's root is CONTROL_ROOT" },
{ path = "std::env::home_dir", reason = "reads HOME; the brake's root is CONTROL_ROOT" },
{ path = "libc::getenv", reason = "the process environment is caller-chosen input; the brake's root is CONTROL_ROOT" },
]