security: Path traversal vulnerability in file upload handler #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The multer uploader middleware uses
file.originalnamedirectly without sanitization when saving uploaded files. This allows attackers to traverse directories and write files outside the intended upload directory using path traversal payloads (e.g.,../../etc/passwd.txt).Location
src/app/middlewares/uploader.tsuploader(multer diskStorage)How to Fix
Replace unsanitized
file.originalnamewith a safe filename. Use uuid or timestamp-based naming:Acceptance Criteria