Package org.apache.solr.core
Class SolrPaths
java.lang.Object
org.apache.solr.core.SolrPaths
Utility methods about paths in Solr.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertNoPathTraversal(Path pathToAssert) Asserts that a path does not contain directory traversalstatic voidassertNotUnc(Path pathToAssert) Asserts that a path is not a Windows UNC pathstatic voidassertPathAllowed(Path pathToAssert, Set<Path> allowPaths) Checks that the given path is relative to one of the allowPaths supplied.static StringnormalizeDir(String path) Ensures a directory name always ends with a '/'.
-
Field Details
-
ALL_PATH
Special path which means to accept all paths.
-
-
Method Details
-
normalizeDir
Ensures a directory name always ends with a '/'. -
assertPathAllowed
public static void assertPathAllowed(Path pathToAssert, Set<Path> allowPaths) throws org.apache.solr.common.SolrException Checks that the given path is relative to one of the allowPaths supplied. Typically this will be called fromCoreContainer.assertPathAllowed(Path)and allowPaths pre-filled with the node's SOLR_HOME, SOLR_DATA_HOME and coreRootDirectory folders, as well as any paths specified in solr.xml's allowPaths element. The following paths will always fail validation:- Relative paths starting with
.. - Windows UNC paths (such as
\\host\share\path) - Paths which are not relative to any of allowPaths
- Parameters:
pathToAssert- path to checkallowPaths- list of paths that should be allowed prefixes for pathToAssert- Throws:
org.apache.solr.common.SolrException- if path is outside allowed paths
- Relative paths starting with
-
assertNoPathTraversal
Asserts that a path does not contain directory traversal -
assertNotUnc
Asserts that a path is not a Windows UNC path
-