diff options
Diffstat (limited to 'utils/provider/src')
-rwxr-xr-x | utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java | 2 | ||||
-rw-r--r-- | utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java b/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java index 29d35d6e..518fb30d 100755 --- a/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java +++ b/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/EnvVarFileResolver.java @@ -62,7 +62,7 @@ public abstract class EnvVarFileResolver implements PropertiesFileResolver { final File fileFromEnvVariable; if (!Strings.isNullOrEmpty(propDirectoryFromEnvVariable)) { fileFromEnvVariable = Paths.get(propDirectoryFromEnvVariable).resolve(filename).toFile(); - if(PathValidator.isValidFilePath(fileFromEnvVariable.getAbsolutePath()) && fileFromEnvVariable.exists()) { + if(PathValidator.isValidPropertiesPath(fileFromEnvVariable.getAbsolutePath()) && fileFromEnvVariable.exists()) { return Optional.of(fileFromEnvVariable); } } diff --git a/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java b/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java index 97352501..08f0fc05 100644 --- a/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java +++ b/utils/provider/src/main/java/org/onap/ccsdk/sli/core/utils/PathValidator.java @@ -3,15 +3,15 @@ import java.util.regex.Pattern; public class PathValidator { public static boolean isValidXmlPath(String path) { - Pattern allowList = Pattern.compile("[-\\w/\\/]+\\.xml$"); + Pattern allowList = Pattern.compile("[-.\\w/\\/]+\\.xml$"); return (allowList.matcher(path).matches()); } public static boolean isValidPropertiesPath(String path) { - Pattern allowList = Pattern.compile("[-\\w/\\/]+\\.properties$"); + Pattern allowList = Pattern.compile("[-.\\w/\\/]+\\.properties$"); return (allowList.matcher(path).matches()); } public static boolean isValidFilePath(String path) { - Pattern allowList = Pattern.compile("[-\\w/\\/]+"); + Pattern allowList = Pattern.compile("[-.\\w/\\/]+$"); return (allowList.matcher(path).matches()); } } |