I'm creating a new file as classpath resource. With the following code, there are critical and high level Path Manipulation issues on Fortify.
public class A {
@Value("classpath:test")
private Resource resource;
public void createFile(MultipartFile sourceFile) {
String fName = FilenameUtils.normalize(sourceFile.getOriginalFilename());
//path manipulation
File newFile = Paths.get(resource.getFile().getPath(),fName).normalize().toFile();
...
}
}
I've tried also normalize the path with FilenameUtils, but still getting the same issues on Fortify. Are these Path Manipulation errors meaningful? Is there any other viable solution?
Btw Sonar scans are clean for vulnerability.
Thanks for any advice!
Regards