public final class PathTraversalResourceUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static void assertPathSegmentIsSecure(java.lang.String pathSegment)
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 ..\
pathSegment - the path segment to checkPathTraversalException - if the pathSegment is not considered secure.Copyright © 2018 SAP SE. All Rights Reserved.