diff --git a/framework/security/config/security.properties b/framework/security/config/security.properties index 141ec7e899..6fbc9b9ea8 100644 --- a/framework/security/config/security.properties +++ b/framework/security/config/security.properties @@ -288,7 +288,7 @@ deniedWebShellTokens=java.,beans,freemarker, getAllowedTokens() { return UtilValidate.isNotEmpty(allowedTokens) ? StringUtil.split(allowedTokens, ",") : new ArrayList<>(); } - // Check there is any allowedToken in URL - private static boolean isAnyAllowedToken(List queryParameters, List allowed) { - boolean isOK = false; - for (String parameter : queryParameters) { - parameter = parameter.substring(0, parameter.indexOf("=") + 1); - if (allowed.contains(HashCrypt.cryptBytes("SHA", "OFBiz", parameter.getBytes(StandardCharsets.UTF_8)))) { - isOK = true; - break; - } else { - continue; - } - } - return isOK; - } - /** * Makes allowed paths pass through while redirecting the others to a fix location. * Reject wrong URLs @@ -198,7 +182,7 @@ public void doFilter(HttpServletRequest req, HttpServletResponse resp, FilterCha } else if (req.getAttribute(FORWARDED_FROM_SERVLET) == null && !allowedPaths.isEmpty()) { // Get the request URI without the webapp mount point. - String uriWithContext = URLDecoder.decode(req.getRequestURI(), "UTF-8"); + String uriWithContext = StringEscapeUtils.unescapeHtml4(URLDecoder.decode(req.getRequestURI(), "UTF-8")); String uri = uriWithContext.substring(context.length()); GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); @@ -227,12 +211,7 @@ && isSolrTest()) { throw new RuntimeException("For security reason this URL is not accepted"); } } - boolean bypass = true; - if (queryString != null) { - List queryStringList = StringUtil.splitWithStringSeparator(queryString.toLowerCase(), "&"); - bypass = isAnyAllowedToken(queryStringList, ALLOWEDTOKENS); - } - if (uriWithContext != null && !bypass) { // "null" allows tests with Mockito. ControlFilterTests sends null. + if (uriWithContext != null) { // "null" allows tests with Mockito because ControlFilterTests sends null. try { String uRIFiltered = new URI(uriWithContext) .normalize().toString()