← Rule catalog

Source kernel · Security

Shell command string built from runtime values

rust_doctor::source::dynamic_shell_command

Avoid the shell and pass values as separate Command arguments to a fixed program; otherwise apply shell-specific escaping at the trust boundary.

Category
Security
Default level
warn
Tier
P0
Producer
Source kernel
Diff scope
item

Not a defect when

Every interpolated value is program-controlled, such as a path from CARGO_MANIFEST_DIR in a build script or a subcommand chosen from a fixed enum, so no untrusted input reaches the shell.

What it reads

Source text, without resolving types or expanding macros.

Tier

Gravest tier: caps the score of its dimension.

The tier bounds how severe a rule may be; its category bounds the tier.

Diff scope

The function or item around the changed line.

What --scope contextual looks at to decide whether a change caused the finding.

Change it

Turn it off, or make it blocking, without touching the code it flags:

rust-doctor --rule rust_doctor::source::dynamic_shell_command=off .
rust-doctor --rule rust_doctor::source::dynamic_shell_command=error .

Set it once in rust-doctor.toml

Other Security rules