Class PathTraversalResourceUtils
java.lang.Object
de.hybris.platform.acceleratorservices.util.PathTraversalResourceUtils
Utility class verify the path for security purposes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertPathSegmentIsSecure(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 Details
-
assertPathSegmentIsSecure
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.
-