I am working with some coverity issues in my source code . Here i am using the code like ,
filePath = properties.getProperty("DO.LIB.LOC");
String fileName = (String) request.getParameter("read");
filePath += "/" + fileName;
downloadResultSet.flushFile(filePath, response,
fileName.substring(fileName.lastIndexOf(".") + 1));
In my coveiry scanned tool found an error like "CID 38762 (#1 of 2): Filesystem path, filename, or URI manipulation (PATH_MANIPULATION) 2. sink: Constructing a path or URI using the tainted value filePath. This may allow an attacker to access, modify, or test the existence of critical or sensitive files. The value is used unsafely in bytecode, which cannot be displayed."
File Path defined in an external property file and file name takes from request .
I am using the same code in different java file for file upload ,delete ,download functionalities . How can i avoid these kind of vulnerabilities from my code . Can any one help me on this ?