os.system or os.popen runs a command built at run time
What it finds
os.system(command), os.popen(command): both pass the command to the system shell. When part of it comes from outside, quotes, ; or $(...) in it can run other commands (CWE-78). subprocess.run with a list of arguments runs a program without a shell.
Calls whose command is a string literal are left alone.
From the rule's source, os_system.rs.
import os def run(name): os.system("rm -rf " + name)tx0 reports: os.system runs a command built at run time through the shell pipe = os.popen(name)tx0 reports: os.popen runs os.system("clear") return pipe Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/python:os-system" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
# tx0: ignore[tx0/python:os-system] reason="..."tx0 explain tx0/python:os-system shows the same in the terminal. Found a false positive? Report it.