Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
I am getting Path traversal file upload, warning in my code

I am getting Path traversal file upload, a warning in my code. I can't understand how to fix that.

this is the error notification

Unsanitized input from an uploaded file flows into jimp.read, where it is used as a path. This may result in a Path Traversal vulnerability and allow an attacker to read arbitrary files.

here is my code

 reqImage = req.files.readmoreImage;

                await Jimp.read(reqImage.data)
                    .then((image) => {
                        image
                            .scaleToFit(263, 342, [
                                Jimp.HORIZONTAL_ALIGN_CENTER,
                                Jimp.VERTICAL_ALIGN_MIDDLE,
                            ])
                            .quality(60)
                            .write(uploadPath);
                    })
                    .catch((err) => {
                        if (err) {
                            req.flash('error', 'Something wrong in image Uploading !');
                            return res.status(302).redirect('back');
                        }
                    });

how to sanitize before upload.

i have sanitize the string using regex like this .replace(/\//g, '\\\\')) but i cant understand to deal with file upload

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!