Package fr.gouv.vitam.common.security
Class SafeFileChecker
- java.lang.Object
-
- fr.gouv.vitam.common.security.SafeFileChecker
-
public class SafeFileChecker extends java.lang.Object
Checker for Sanity of file manipulation to avoid Path Traversal vulnerability- Author:
- afraoucene
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
checkSafeFilePath(java.lang.String path)
do an ESAPI path sanityCheck and prevent a path traversal attackstatic void
checkSafeFilePath(java.lang.String rootPath, java.lang.String... subPaths)
do an ESAPI path sanityCheck and prevent a path traversal attackstatic void
checkSafePluginsFilesPath(java.lang.String path)
do an ESAPI path sanityCheck and prevent a path traversal attack
-
-
-
Method Detail
-
checkSafeFilePath
public static void checkSafeFilePath(java.lang.String path) throws java.io.IOException
do an ESAPI path sanityCheck and prevent a path traversal attack- Parameters:
path
- full path representing a FileSystem resource- Throws:
java.io.IOException
- thrown when any check fails with UnChecked or Runtime exception
-
checkSafePluginsFilesPath
public static void checkSafePluginsFilesPath(java.lang.String path) throws java.io.IOException
do an ESAPI path sanityCheck and prevent a path traversal attack- Parameters:
path
- full path representing a FileSystem resource- Throws:
java.io.IOException
- thrown when any check fails with UnChecked or Runtime exception
-
checkSafeFilePath
public static void checkSafeFilePath(java.lang.String rootPath, java.lang.String... subPaths) throws java.io.IOException
do an ESAPI path sanityCheck and prevent a path traversal attack- Parameters:
rootPath
- first or initial part(s) of a path representing a FileSystem resourcesubPaths
- sub (additional) parts after root part(s) to be joined to rootPath parameter using File.separator FileSystem String- Throws:
java.io.IOException
- thrown when any check fails with UnChecked or Runtime exception
-
-