Package org.onlab.util
Class FilePathValidator
- java.lang.Object
-
- org.onlab.util.FilePathValidator
-
public final class FilePathValidator extends java.lang.Object
Utilities for validation of Zip files.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
validateFile(java.io.File destinationFile, java.io.File destinationDir)
Validates a File.static boolean
validateZipEntry(java.util.zip.ZipEntry entry, java.io.File destinationDir)
Validates a zip entry.
-
-
-
Method Detail
-
validateFile
public static boolean validateFile(java.io.File destinationFile, java.io.File destinationDir)
Validates a File. Checks that the file being created does not lie outside the target directory.- Parameters:
destinationFile
- file to checkdestinationDir
- target directory- Returns:
- true if the Entry resolves to a file inside the target directory; false otherwise
-
validateZipEntry
public static boolean validateZipEntry(java.util.zip.ZipEntry entry, java.io.File destinationDir)
Validates a zip entry. Checks that the file being created does not lie outside the target directory. See https://snyk.io/research/zip-slip-vulnerability for more information.- Parameters:
entry
- ZipEntry to checkdestinationDir
- target directory- Returns:
- true if the Entry resolves to a file inside the target directory; false otherwise
-
-