Class PathTraversalResourceUtils
- java.lang.Object
-
- de.hybris.platform.acceleratorservices.util.PathTraversalResourceUtils
-
public final class PathTraversalResourceUtils extends java.lang.ObjectUtility class verify the path for security purposes.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidassertPathSegmentIsSecure(java.lang.String pathSegment)Asserts that a given String represents a single path segment that can securely be used to access a file-system or classpath resource.
-
-
-
Method Detail
-
assertPathSegmentIsSecure
public static void assertPathSegmentIsSecure(java.lang.String pathSegment)
Asserts that a given String represents a single path segment that can securely be used to access a file-system or classpath resource.This assertion is performed in a platform independent but very conservative manner. In particular, the following conditions must be met:
* The pathSegment must not contain sequence of two periods followed by a forward slash or back slash. (These represent the parent directory respectively on many file-systems.) In the form ../ or ..\- Parameters:
pathSegment- the path segment to check- Throws:
PathTraversalException- if the pathSegment is not considered secure.
-
-