Skip to content

harden: add path validation in generate_cu_files.py... - #4022

Closed
anupamme wants to merge 1 commit into
ggml-org:masterfrom
anupamme:fix-repo-whisper-cpp-path-traversal-generate-cu-files
Closed

harden: add path validation in generate_cu_files.py...#4022
anupamme wants to merge 1 commit into
ggml-org:masterfrom
anupamme:fix-repo-whisper-cpp-path-traversal-generate-cu-files

Conversation

@anupamme

Copy link
Copy Markdown

Summary

Harden input handling in ggml/src/ggml-cuda/template-instances/generate_cu_files.py (flagged by semgrep).

Vulnerability

Field Value
ID utils.custom.path-traversal-open
Severity HIGH
Scanner semgrep
Rule utils.custom.path-traversal-open
File ggml/src/ggml-cuda/template-instances/generate_cu_files.py:70
Assessment Defensive hardening

Description: User-controlled input used in file path for open() without sanitization. This can allow path traversal attacks to read arbitrary files.

Threat Model Context

This is a local CLI tool - exploitation requires the attacker to control command-line arguments or input files.

Changes

  • ggml/src/ggml-cuda/template-instances/generate_cu_files.py

Behavior Preservation

The change is scoped to 1 file on the vulnerable path; it only tightens handling of untrusted input and leaves valid inputs unaffected.


This patch removes an exploit primitive — a code pattern that, while not independently exploitable today, could be chained with other weaknesses by automated exploit-development tooling. Proactive removal of such primitives raises the bar against increasingly capable automated attack tools.


Automated security fix by OrbisAI Security

Automated security fix generated by OrbisAI Security
@danbev danbev closed this Aug 28, 2026
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.

2 participants