Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Open
tomaioo wants to merge 1 commit into
ModelTC:mainModelTC/LightLLM:mainfrom
tomaioo:fix/security/command-injection-via-os-system-in-formatomaioo/LightLLM:fix/security/command-injection-via-os-system-in-formaCopy head branch name to clipboard
Open

fix(security): 2 improvements across 1 files#1401
tomaioo wants to merge 1 commit into
ModelTC:mainModelTC/LightLLM:mainfrom
tomaioo:fix/security/command-injection-via-os-system-in-formatomaioo/LightLLM:fix/security/command-injection-via-os-system-in-formaCopy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.