File tree Expand file tree Collapse file tree 5 files changed +44
-12
lines changed
Expand file tree Collapse file tree 5 files changed +44
-12
lines changed Original file line number Diff line number Diff line change 88 <name >Ch04_OutputEscaping</name >
99 <description >Chapter 4 Output Escaping sample project. Requires a server like Apache Tomcat.
1010
11- Open the web application in your browser at http://localhost:8080/OutputEscaping/ </description >
11+ Open the web application in your browser at http://localhost:8080/Ch04_OutputEscaping </description >
1212 <url >https://github.com/dschadow/JavaWebAppSecurity</url >
1313
1414 <properties >
@@ -20,11 +20,17 @@ Open the web application in your browser at http://localhost:8080/OutputEscaping
2020 <groupId >org.owasp.esapi</groupId >
2121 <artifactId >esapi</artifactId >
2222 <version >2.0.1</version >
23+ <exclusions >
24+ <exclusion >
25+ <groupId >javax.servlet</groupId >
26+ <artifactId >servlet-api</artifactId >
27+ </exclusion >
28+ </exclusions >
2329 </dependency >
2430 </dependencies >
2531
2632 <build >
27- <finalName >OutputEscaping </finalName >
33+ <finalName >Ch04_OutputEscaping </finalName >
2834 <plugins >
2935 <plugin >
3036 <artifactId >maven-compiler-plugin</artifactId >
Original file line number Diff line number Diff line change 33<html >
44<head >
55 <meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
6+ <link rel =" stylesheet" type =" text/css" href =" styles.css" />
67 <title >Output-Escaping</title >
78</head >
89<body >
1314 <form name =" noOutputEscaping" method =" post" action =" noOutputEscaping.jsp" >
1415 <table >
1516 <tr >
16- <td >Name</td >
17- <td ><input type =" text" name = " name" ></td >
18- <td ><input type =" submit" value =" Submit" ></td >
17+ <td >< label for = " unprotected " title = " Name" >Name</ label > </td >
18+ <td ><input type =" text" id = " unprotected " name = " unprotected " / ></td >
19+ <td ><input type =" submit" value =" Submit" / ></td >
1920 </tr >
2021 </table >
2122 </form >
2526 <form name =" withOutputEscaping" method =" post" action =" withOutputEscaping.jsp" >
2627 <table >
2728 <tr >
28- <td >Name</td >
29- <td ><input type =" text" name = " name" ></td >
30- <td ><input type =" submit" name =" submit" value =" Submit" ></td >
29+ <td >< label for = " protected " title = " Name" >Name</ label > </td >
30+ <td ><input type =" text" id = " protected " name = " protected " / ></td >
31+ <td ><input type =" submit" name =" submit" value =" Submit" / ></td >
3132 </tr >
3233 </table >
3334 </form >
Original file line number Diff line number Diff line change 33<html >
44<head >
55 <meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
6+ <link rel =" stylesheet" type =" text/css" href =" styles.css" />
67 <title >Without Output-Escaping</title >
78</head >
89<body >
9- <strong >Hello</strong > <%= request. getParameter(" name" ) % >
10+ <h1 >Without Output-Escaping</h1 >
11+ <strong >Hello</strong > <%= request. getParameter(" unprotected" ) % >
1012</body >
1113</html >
Original file line number Diff line number Diff line change 1+ .text-input {
2+ width : 250px ;
3+ }
4+
5+ .send-button {
6+ font-size : 115% ;
7+ }
8+
9+ h1 {
10+ font-size : 150% ;
11+ }
12+
13+ h2 {
14+ font-size : 125% ;
15+ }
16+
17+ td {
18+ font-size : 115% ;
19+ }
Original file line number Diff line number Diff line change 33<html >
44<head >
55 <meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
6- <title >With Output-Escaping</title >
6+ <link rel =" stylesheet" type =" text/css" href =" styles.css" />
7+ <title >With ESAPI Output-Escaping</title >
78</head >
89<body >
9- <h1 >ESAPI</h1 >
10+ <h1 >With ESAPI Output-Escaping </h1 >
1011 <%@ page import =" org.owasp.esapi.ESAPI" %>
11- <strong >Hello</strong > <%= ESAPI . encoder(). encodeForHTML(request. getParameter(" name" )) % >
12+ <p >(html) <strong >Hello</strong > <%= ESAPI . encoder(). encodeForHTML(request. getParameter(" protected" )) % > </p >
13+ <p >(html attribute) <strong >Hello</strong > <%= ESAPI . encoder(). encodeForHTMLAttribute(request. getParameter(" protected" )) % > </p >
14+ <p >(css) <strong >Hello</strong > <%= ESAPI . encoder(). encodeForCSS(request. getParameter(" protected" )) % > </p >
15+ <p >(xml) <strong >Hello</strong > <%= ESAPI . encoder(). encodeForXML(request. getParameter(" protected" )) % > </p >
1216</body >
1317</html >
You can’t perform that action at this time.
0 commit comments