Skip to content

Commit b0b14bf

Browse files
author
patched.codes[bot]
committed
Patched src/com/ibm/security/appscan/altoromutual/servlet/SurveyServlet.java
1 parent 216c9b9 commit b0b14bf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/com/ibm/security/appscan/altoromutual/servlet/SurveyServlet.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,19 @@ else if (step.equals("done")){
9595
content = "<h1>Request Out of Order</h1>"+
9696
"<div width=\"99%\"><p>It appears that you attempted to skip or repeat some areas of this survey. Please <a href=\"survey_questions.jsp\">return to the start page</a> to begin again.</p></div>";
9797
} else {
98-
request.getSession().setAttribute("surveyStep", step);
98+
String step = request.getParameter("step");
99+
public String sanitizeInput(String input) {
100+
return input.replaceAll("[^a-zA-Z0-9]", "");
101+
}
102+
String sanitizedStep = sanitizeInput(step);
103+
request.getSession().setAttribute("surveyStep", sanitizedStep);
104+
99105
}
100106
response.setContentType("text/html");
101-
response.getWriter().write(content);
107+
import org.owasp.esapi.ESAPI;
108+
109+
String safeContent = ESAPI.encoder().encodeForHTML(content);
110+
response.getWriter().write(safeContent);
102111
response.getWriter().flush();
103112

104113
}

0 commit comments

Comments
 (0)