Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix path traversal vulnerability in audio upload - #30

Merged
adihex merged 2 commits into
mainfrom
security-fix-path-traversal-1312105445582802999
Sep 5, 2026
Merged

adihex merged 2 commits into
mainfrom
security-fix-path-traversal-1312105445582802999

Conversation

@adihex

@adihex adihex commented Sep 4, 2026

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: The /transcribe endpoint used path.basename on file.name to construct a temporary filename for audio files. In a POSIX environment, path.basename does not strip shell metacharacters or Windows-style directory separators (\), posing a risk of command injection or path traversal if that temporary file were passed into subshells.
🎯 Impact: Attackers could inject arbitrary commands when the server processes the temp file via whisper.cpp or could potentially traverse the file system if the constructed path is used elsewhere.
πŸ”§ Fix: Sanitize file.name by replacing all non-alphanumeric characters (except dots and hyphens) with underscores (_) before appending it to the base temp path.
βœ… Verification: Ran unit and e2e test suites to ensure files still upload successfully and the name parses cleanly. Tests passing.


PR created automatically by Jules for task 1312105445582802999 started by @adihex

Sanitize the uploaded file's name using a safe regex (`replace(/[^a-zA-Z0-9.-]/g, '_')`) when extracting the base name. This prevents an attacker from supplying shell metacharacters or using directory traversal strings when running on POSIX systems, ensuring a safe temporary filename is used during processing.

Co-authored-by: adihex <82704954+adihex@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Preserve the basename normalization and filename allowlist from PR #30 alongside the changes merged through PR #29.

Run-on: Niteshift
@adihex
adihex merged commit 064d639 into main Sep 5, 2026
1 check passed
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