File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
java/ql/src/Security/CWE/CWE-079 Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
public class XSS extends HttpServlet {
2
2
protected void doGet (HttpServletRequest request , HttpServletResponse response )
3
3
throws ServletException , IOException {
4
- // BAD: a request parameter is written directly to an error response page
5
- response .sendError ( HttpServletResponse . SC_NOT_FOUND ,
4
+ // BAD: a request parameter is written directly to the Servlet response stream
5
+ response .getWriter (). print (
6
6
"The page \" " + request .getParameter ("page" ) + "\" was not found." );
7
+
7
8
}
8
9
}
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ reference.</p>
18
18
</recommendation >
19
19
<example >
20
20
21
- <p >The following example shows the page parameter being written directly to the server error page,
21
+ <p >The following example shows the < code > page</ code > parameter being written directly to the page,
22
22
leaving the website vulnerable to cross-site scripting.</p >
23
23
24
24
<sample src =" XSS.java" />
You can’t perform that action at this time.
0 commit comments