tmbdev / tarproc

Starting a process with a shell detected BAN-B605
Security
Major
4 years ago4 years old
Starting a process with a shell, possible injection detected, security issue.
 64    "Tag the current version as a release on Github."
 65    assert "working tree clean" in c.run("git status").stdout
 66    version = open("VERSION").read().strip()
 67    os.system(f"hub release create {version}")  # interactive 68
 69
 70pydoc_template = """
Starting a process with a shell, possible injection detected, security issue.
 91    for fname in glob.glob("tarproclib/*.py"):
 92        module, ext = os.path.splitext(fname)
 93        module = re.sub("/", ".", module)
 94        with os.popen(f"{ACTIVATE}{PYTHON3} -m pydoc {module}") as stream: 95            text = stream.read()
 96        document += pydoc_template.format(text=text, module=module)
 97    with open("docs/pydoc.md", "w") as stream:
Starting a process with a shell, possible injection detected, security issue.
 98        stream.write(document)
 99    document = ""
100    for command in commands:
101        with os.popen(f"{ACTIVATE}{PYTHON3}{command} --help ") as stream:102            text = stream.read()
103        text = re.sub("```", "", text)
104        document = command_template.format(text=text, command=command)
Starting a process with a shell: Seems safe, but may be changed in the future, consider rewriting without shell
109@task(gendocs)
110def pubdocs(c):
111    "Generate and publish docs."
112    modified = os.popen("git status").readlines()113    for line in modified:
114        if "modified:" in line and ".md" not in line:
115            print("non-documentation file modified; commit manually", file=sys.stderr)