Class Sanitize
java.lang.Object
com.onenetwork.platform.tools.util.Sanitize
public class Sanitize
extends java.lang.Object
Utilities used to "sanitize" user input to prevent issues like XSS, SQL Injection, etc.
-
Field Summary
Fields Modifier and Type Field Description static java.util.regex.Pattern
DISALLOW_VAR_EVAL_PATTERN
static java.util.regex.Pattern
NON_SAFE_PATH_PATTERN
static java.util.regex.Pattern
SAFE_PATH_PATTERN
-
Constructor Summary
Constructors Constructor Description Sanitize()
-
Method Summary
Modifier and Type Method Description static java.lang.String
sanitizePathSafety(java.lang.String path)
This method is the same as validatePathSafety except it returns a string This method is the preferred one for code checked by Checkmarx since it only considers a method to be a sanitizer of a variable if it affects its contentstatic void
validatePathSafety(java.lang.String path)
Ensures the path can safely be used, and won't jump into other directories on the filesystem
-
Field Details
-
SAFE_PATH_PATTERN
public static final java.util.regex.Pattern SAFE_PATH_PATTERN -
NON_SAFE_PATH_PATTERN
public static final java.util.regex.Pattern NON_SAFE_PATH_PATTERN -
DISALLOW_VAR_EVAL_PATTERN
public static final java.util.regex.Pattern DISALLOW_VAR_EVAL_PATTERN
-
-
Constructor Details
-
Sanitize
public Sanitize()
-
-
Method Details
-
validatePathSafety
public static void validatePathSafety(java.lang.String path)Ensures the path can safely be used, and won't jump into other directories on the filesystem -
sanitizePathSafety
public static java.lang.String sanitizePathSafety(java.lang.String path)This method is the same as validatePathSafety except it returns a string This method is the preferred one for code checked by Checkmarx since it only considers a method to be a sanitizer of a variable if it affects its content- Returns:
- String
-