π‘οΈ Sentinel: [HIGH] Fix path traversal vulnerability in audio upload - #30
Conversation
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>
|
π 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: HIGH
π‘ Vulnerability: The
/transcribeendpoint usedpath.basenameonfile.nameto construct a temporary filename for audio files. In a POSIX environment,path.basenamedoes 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.cppor could potentially traverse the file system if the constructed path is used elsewhere.π§ Fix: Sanitize
file.nameby 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