Package com.gmt2001
Class PathValidator
java.lang.Object
com.gmt2001.PathValidator
- Author:
- gmt2001
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic PathgetRealPath(String path) static PathgetRealPath(Path path) static booleanisPathUnderExecutionOrDockerWeb(Path absolutePath) Returns true if the given absolute path is under the bot./webtree at the execution directory, or (when running in Docker) undergetDockerPath()/web.static booleanisValidPathLang(String pathToFile) static booleanisValidPathScript(String pathToFile) static booleanisValidPathShared(String pathToFile) static booleanisValidPathWeb(String pathToFile) static booleanisValidPathWebAuth(String pathToFile)
-
Method Details
-
getRealPath
-
getRealPath
-
getDockerPath
-
isValidPathScript
-
isValidPathWeb
-
isValidPathWebAuth
-
isValidPathLang
-
isPathUnderExecutionOrDockerWeb
Returns true if the given absolute path is under the bot./webtree at the execution directory, or (when running in Docker) undergetDockerPath()/web. Used by HTTP handlers that must mirrorisValidPathWebAuth(java.lang.String)disk layout rules.- Parameters:
absolutePath- normalized or absolute path to test- Returns:
- whether the path is confined to an allowed web root
-