Я пытался очистить путь перед передачей его объекту File, но проблема не устранена .
Попробовал также эту ссылку:
https://www.securecoding.cert.org/confl ... +in+shared +каталоги
Код: Выделить всё
public static String sanitizePath(String sUnsanitized) throws URISyntaxException, EncodingException {
String sSanitized = SAPI.encoder().canonicalize(sUnsanitized);
return sSanitized;
}
//// the main method code snippet /////
String sSanitizedPath = Utils.sanitizePath(file.getOriginalFilename());
-- fortify scan detects problem here ..in below line --
File filePath = new File(AppInitializer.UPLOAD_LOCATION, sSanitizedPath);
String canonicalPath = filePath.getCanonicalPath();
FileOutputStream fileOutputStream = new FileOutputStream(canonicalPath);
Подробнее здесь: https://stackoverflow.com/questions/558 ... tation-dat