Skip to content

fix(security): 2 improvements across 1 files#1401

Open
tomaioo wants to merge 1 commit into
ModelTC:mainfrom
tomaioo:fix/security/command-injection-via-os-system-in-forma
Open

fix(security): 2 improvements across 1 files#1401
tomaioo wants to merge 1 commit into
ModelTC:mainfrom
tomaioo:fix/security/command-injection-via-os-system-in-forma

Conversation

@tomaioo

@tomaioo tomaioo commented Jul 23, 2026

Copy link
Copy Markdown

Summary

fix(security): 2 improvements across 1 files

Problem

Severity: Medium | File: format.py:L4

The format.py script uses os.system(f"autopep8 ... {filename}") where filename is derived from glob.glob. While glob.glob is generally safe, using os.system with f-strings is a dangerous anti-pattern. If the repository is ever cloned or placed in a directory with maliciously named Python files (e.g., a file named foo.py; rm -rf /), it could lead to arbitrary command execution.

Solution

Replace os.system with subprocess.run using a list of arguments to avoid shell interpretation. For example: subprocess.run(['autopep8', '--max-line-length', '140', '--in-place', '--aggressive', '--aggressive', filename]).

Changes

  • format.py (modified)

- Security: Command Injection via os.system in Formatting Script
- Quality: Command injection vulnerability in formatting script

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant