Package com.atlassian.confluence.util
Class FilesystemUtils
java.lang.Object
com.atlassian.confluence.util.FilesystemUtils
- Since:
- 8.6
- 
Field SummaryFieldsModifier and TypeFieldDescription
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanChecks if the given string contains any of the forbidden path traversal patterns.static booleanChecks if the given string contains any of the forbidden path traversal patterns.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.
- 
Field Details- 
FORBIDDEN_PATH_EQUALS
- 
FORBIDDEN_PATH_CONTAINS
- 
FORBIDDEN_PATH_ENDINGS
 
- 
- 
Constructor Details- 
FilesystemUtilspublic FilesystemUtils()
 
- 
- 
Method Details- 
isSafeTitleForFilesystemEnsure 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
 
- 
containsPathTraversalChecks if the given string contains any of the forbidden path traversal patterns.- Parameters:
- str- The string to check
- Returns:
- True if the string contains any of the forbidden path traversal patterns
 
- 
containsEncodedPathTraversalChecks if the given string contains any of the forbidden path traversal patterns. The string is first decoded usingHtmlUtil.loopedUrlDecode(String).- Parameters:
- str- The string to check
- Returns:
- True if the string contains any of the forbidden path traversal patterns
 
- 
isSafePathEnsures 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:
 
 
-