diff --git a/openelis/WebContent/pages/result/resultListView.jsp b/openelis/WebContent/pages/result/resultListView.jsp
index adc711a7f..b33d6dcb1 100644
--- a/openelis/WebContent/pages/result/resultListView.jsp
+++ b/openelis/WebContent/pages/result/resultListView.jsp
@@ -1114,7 +1114,7 @@ function /*void*/ processTestReflexCD4Success(xhr)
-
+
<% if(testResult.getUploadedFileName() != null){ %>
<% String filePath = testResult.getUploadedFileName();
String fileNameWithUUID = filePath.substring(filePath.lastIndexOf("/") + 1);
@@ -1215,3 +1215,20 @@ function /*void*/ processTestReflexCD4Success(xhr)
+
+
\ No newline at end of file
diff --git a/openelis/src/us/mn/state/health/lims/common/util/SafeRequest.java b/openelis/src/us/mn/state/health/lims/common/util/SafeRequest.java
index 63446e19f..cf4b44b87 100644
--- a/openelis/src/us/mn/state/health/lims/common/util/SafeRequest.java
+++ b/openelis/src/us/mn/state/health/lims/common/util/SafeRequest.java
@@ -1,57 +1,83 @@
package us.mn.state.health.lims.common.util;
+
+import java.util.regex.Pattern;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
public class SafeRequest extends HttpServletRequestWrapper {
+
private final Logger logger = LogManager.getLogger(SafeRequest.class);
private List ignoreEncodingForParams = Arrays.asList("sampleXML");
- public SafeRequest(HttpServletRequest request) {
- super(request);
+ private static Pattern[] patterns = new Pattern[]{
+ // Script fragments
+ Pattern.compile("", Pattern.CASE_INSENSITIVE),
+ // src='...'
+ Pattern.compile("src[\r\n]*=[\r\n]*\\\'(.*?)\\\'", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
+ Pattern.compile("src[\r\n]*=[\r\n]*\\\"(.*?)\\\"", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
+ // lonely script tags
+ Pattern.compile("", Pattern.CASE_INSENSITIVE),
+ Pattern.compile(" |