security - node.js - secure image file upload -


we had implement image uploader node.js project. framework using express.js did described here: http://howtonode.org/really-simple-file-uploads

but not sure how secure image uploader. did far is:

  • checking file size
  • checking extension , header
  • rename file
  • file accessible on special route , not in root folder

is enough? don't feel comfortable following line:

    // checking filesize, extension, headers     fs.readfile(req.files.displayimage.path, function (err, data) {         ...         ...         ...         // renaming file         // save file         ...         ...         ...     } 

is save read image way? afraid, there malicious code in req.files.displayimage.path. need add more checks or our checks sufficient? attack vectors offer attacker if use code described?

thank advices tschoartschi


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

java - How should I set a HttpURLConnection to be the same as a HttpServletRequest? -