File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed 
src/com/ibm/security/appscan/altoromutual/servlet Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -98,8 +98,18 @@ else if (step.equals("done")){
9898			request .getSession ().setAttribute ("surveyStep" , step );
9999		}
100100		response .setContentType ("text/html" );
101- 		response .getWriter ().write (content );
102- 		response .getWriter ().flush ();
101+ 		import  org .apache .commons .text .StringEscapeUtils ;
102+ 		
103+ 		// Get user input 
104+ 		String  userInput  = request .getParameter ("userInput" );
105+ 		// Encode the input using the Html4 encoder 
106+ 		String  htmlEncodedContent  = StringEscapeUtils .escapeHtml4 (userInput );
107+ 		// Force the HTTP response to be content type of text/plain so it is not interpreted as HTML 
108+ 		response .setContentType ("text/plain" );
109+ 		// Ensure UTF-8 
110+ 		response .setCharacterEncoding ("UTF-8" );
111+ 		// Write response 
112+ 		response .getWriter ().write (htmlEncodedContent );		response .getWriter ().flush ();
103113
104114	}
105115}
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments