Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix path traversal in file uploads - #29

Merged
adihex merged 2 commits into
mainfrom
fix/sentinel-path-traversal-12258315872887433358
Sep 5, 2026
Merged

adihex merged 2 commits into
mainfrom
fix/sentinel-path-traversal-12258315872887433358

Conversation

@adihex

@adihex adihex commented Sep 4, 2026

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: A path traversal vulnerability existed in the audio upload handler (/transcribe) because path.basename does not strip Windows-style path separators (\) when running in a POSIX environment. An attacker could bypass filename extraction by supplying a filename like ..\..\..\etc\passwd, which would be processed as a literal string by path.basename and resolved as an absolute path by path.join, leading to arbitrary file write.
🎯 Impact: Arbitrary file write to the server's filesystem, which could lead to remote code execution (RCE) or system compromise.
πŸ”§ Fix: Replaced path.basename(file.name) with a strict regex substitution file.name.replace(/[^a-zA-Z0-9.-]/g, "_"). This sanitizes the filename to only contain safe alphanumeric characters, dots, and hyphens, completely removing any risk of directory traversal characters.
βœ… Verification: Upload an audio file with a filename containing ..\..\ to the /transcribe endpoint and observe that the saved file name uses underscores instead of backslashes, effectively rendering the traversal string harmless. Ensure tests run successfully (pnpm test).


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

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.

@adihex
adihex merged commit 4fe8f3d into main Sep 5, 2026
1 check passed
adihex added a commit that referenced this pull request Sep 5, 2026
Preserve the basename normalization and filename allowlist from PR #30 alongside the changes merged through PR #29.

Run-on: Niteshift
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