Package com.atlassian.confluence.util
Class FilesystemUtils
java.lang.Object
com.atlassian.confluence.util.FilesystemUtils
- Since:
- 8.6
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanDeprecated.since 9.2.4.static booleancontainsEncodedPathTraversal(String str, Charset charset) Checks if the given string contains any of the forbidden path traversal patterns or in their encoded form.static StringgetFileChecksum(String path) static booleanisSafePath(String path) Ensures the path is safe and is not vulnerable to path traversal vulnerabilities.static booleanisSafePath(Path path) static booleanisSafeTitleForFilesystem(String title) Ensure the title is safe to be written to the file system.
-
Constructor Details
-
FilesystemUtils
public FilesystemUtils()
-
-
Method Details
-
isSafeTitleForFilesystem
Ensure the title is safe to be written to the file system.- Parameters:
title- The title to check- Returns:
- True if the title is safe for the filesystem, false otherwise
-
containsEncodedPathTraversal
Checks if the given string contains any of the forbidden path traversal patterns or in their encoded form.- Parameters:
str- The string to check- Returns:
- true if the string contains any of the forbidden path traversal patterns
-
containsEncodedPathTraversal
Deprecated.since 9.2.4. UsecontainsEncodedPathTraversal(String, Charset)instead. -
isSafePath
Ensures the path is safe and is not vulnerable to path traversal vulnerabilities. On top of filesystem specific checks it also rejects any paths containing risky path elements known to cause path traversal issues in different file systems (e.g. `..`, `/..`, `..\`).- Parameters:
path- The path to check- Returns:
- True if the path is safe
-
isSafePath
- Parameters:
path- The path to check- Returns:
- True if the path is safe
- See Also:
-
getFileChecksum
-