π‘οΈ Sentinel: [CRITICAL] Fix Path Traversal in video API route#148
Conversation
Sanitize user-provided filename using path.basename() before writing to the filesystem to prevent Path Traversal vulnerabilities when processing videos. Co-authored-by: Cukurikik <[email protected]>
|
π 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. |
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: π Files selected for processing (1)
π WalkthroughWalkthroughThe POST handler for the video API endpoint now sanitizes uploaded filenames using Changes
Estimated code review effortπ― 2 (Simple) | β±οΈ ~8 minutes Poem
π₯ Pre-merge checks | β 2 | β 1β Failed checks (1 warning)
β Passed checks (2 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ Generate docstrings
π§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
π¨ Severity: CRITICAL
π‘ Vulnerability: Path traversal vulnerability in
src/app/api/video/[tool]/route.ts. The user-providedfile.namewas being concatenated directly into the output path without sanitization, allowing potential writes outside the/tmp/omni/videodirectory.π― Impact: Attackers could potentially write arbitrary files or overwrite existing files on the server's filesystem by using relative path segments (e.g.,
../../../) in the filename.π§ Fix: Sanitized the user-provided filename using
path.basename(file.name)and correctly joined the segments usingpath.join().β Verification: Ran
pnpm exec tsc --noEmitandpnpm vitest runto ensure there are no compilation or testing regressions. Visual inspection confirms the filename is properly sanitized before appending it to the base directory.PR created automatically by Jules for task 10186366171341972028 started by @Cukurikik
Summary by CodeRabbit
Bug Fixes