Skip to content

Commit f43941f

Browse files
committed
Missed one fix, so had to check in a few more test cases affected by it.
The random variable naming causes many others to change that didn't really change.
1 parent 26bfa37 commit f43941f

File tree

656 files changed

+4771
-4721
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

656 files changed

+4771
-4721
lines changed

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00059.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5353
}
5454

5555

56-
StringBuilder sbxyz54487 = new StringBuilder(param);
57-
String bar = sbxyz54487.append("_SafeStuff").toString();
56+
StringBuilder sbxyz78018 = new StringBuilder(param);
57+
String bar = sbxyz78018.append("_SafeStuff").toString();
5858

5959

6060
// Code based on example from:

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00062.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5454

5555

5656
String bar = "safe!";
57-
java.util.HashMap<String,Object> map57069 = new java.util.HashMap<String,Object>();
58-
map57069.put("keyA-57069", "a Value"); // put some stuff in the collection
59-
map57069.put("keyB-57069", param); // put it in a collection
60-
map57069.put("keyC", "another Value"); // put some stuff in the collection
61-
bar = (String)map57069.get("keyB-57069"); // get it back out
57+
java.util.HashMap<String,Object> map68657 = new java.util.HashMap<String,Object>();
58+
map68657.put("keyA-68657", "a Value"); // put some stuff in the collection
59+
map68657.put("keyB-68657", param); // put it in a collection
60+
map68657.put("keyC", "another Value"); // put some stuff in the collection
61+
bar = (String)map68657.get("keyB-68657"); // get it back out
6262

6363

6464
String fileName = null;

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00066.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
7474

7575
boolean foundUser = false;
7676
javax.servlet.http.Cookie[] cookies = request.getCookies();
77-
for (int i = 0; cookies != null && ++i < cookies.length && !foundUser;) {
78-
javax.servlet.http.Cookie cookie = cookies[i];
79-
if (cookieName.equals(cookie.getName())) {
80-
if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {
81-
foundUser = true;
77+
if (cookies != null) {
78+
for (int i = 0; !foundUser && i < cookies.length; i++) {
79+
javax.servlet.http.Cookie cookie = cookies[i];
80+
if (cookieName.equals(cookie.getName())) {
81+
if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {
82+
foundUser = true;
83+
}
8284
}
8385
}
8486
}

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00067.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -54,20 +54,20 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5454

5555

5656
// Chain a bunch of propagators in sequence
57-
String a38294 = param; //assign
58-
StringBuilder b38294 = new StringBuilder(a38294); // stick in stringbuilder
59-
b38294.append(" SafeStuff"); // append some safe content
60-
b38294.replace(b38294.length()-"Chars".length(),b38294.length(),"Chars"); //replace some of the end content
61-
java.util.HashMap<String,Object> map38294 = new java.util.HashMap<String,Object>();
62-
map38294.put("key38294", b38294.toString()); // put in a collection
63-
String c38294 = (String)map38294.get("key38294"); // get it back out
64-
String d38294 = c38294.substring(0,c38294.length()-1); // extract most of it
65-
String e38294 = new String( new sun.misc.BASE64Decoder().decodeBuffer(
66-
new sun.misc.BASE64Encoder().encode( d38294.getBytes() ) )); // B64 encode and decode it
67-
String f38294 = e38294.split(" ")[0]; // split it on a space
57+
String a40112 = param; //assign
58+
StringBuilder b40112 = new StringBuilder(a40112); // stick in stringbuilder
59+
b40112.append(" SafeStuff"); // append some safe content
60+
b40112.replace(b40112.length()-"Chars".length(),b40112.length(),"Chars"); //replace some of the end content
61+
java.util.HashMap<String,Object> map40112 = new java.util.HashMap<String,Object>();
62+
map40112.put("key40112", b40112.toString()); // put in a collection
63+
String c40112 = (String)map40112.get("key40112"); // get it back out
64+
String d40112 = c40112.substring(0,c40112.length()-1); // extract most of it
65+
String e40112 = new String( new sun.misc.BASE64Decoder().decodeBuffer(
66+
new sun.misc.BASE64Encoder().encode( d40112.getBytes() ) )); // B64 encode and decode it
67+
String f40112 = e40112.split(" ")[0]; // split it on a space
6868
org.owasp.benchmark.helpers.ThingInterface thing = org.owasp.benchmark.helpers.ThingFactory.createThing();
69-
String g38294 = "barbarians_at_the_gate"; // This is static so this whole flow is 'safe'
70-
String bar = thing.doSomething(g38294); // reflection
69+
String g40112 = "barbarians_at_the_gate"; // This is static so this whole flow is 'safe'
70+
String bar = thing.doSomething(g40112); // reflection
7171

7272

7373
double value = java.lang.Math.random();
@@ -82,11 +82,13 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
8282

8383
boolean foundUser = false;
8484
javax.servlet.http.Cookie[] cookies = request.getCookies();
85-
for (int i = 0; cookies != null && ++i < cookies.length && !foundUser;) {
86-
javax.servlet.http.Cookie cookie = cookies[i];
87-
if (cookieName.equals(cookie.getName())) {
88-
if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {
89-
foundUser = true;
85+
if (cookies != null) {
86+
for (int i = 0; !foundUser && i < cookies.length; i++) {
87+
javax.servlet.http.Cookie cookie = cookies[i];
88+
if (cookieName.equals(cookie.getName())) {
89+
if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {
90+
foundUser = true;
91+
}
9092
}
9193
}
9294
}

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00068.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
7474

7575
boolean foundUser = false;
7676
javax.servlet.http.Cookie[] cookies = request.getCookies();
77-
for (int i = 0; cookies != null && ++i < cookies.length && !foundUser;) {
78-
javax.servlet.http.Cookie cookie = cookies[i];
79-
if (cookieName.equals(cookie.getName())) {
80-
if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {
81-
foundUser = true;
77+
if (cookies != null) {
78+
for (int i = 0; !foundUser && i < cookies.length; i++) {
79+
javax.servlet.http.Cookie cookie = cookies[i];
80+
if (cookieName.equals(cookie.getName())) {
81+
if (cookie.getValue().equals(request.getSession().getAttribute(cookieName))) {
82+
foundUser = true;
83+
}
8284
}
8385
}
8486
}

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00074.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5454

5555

5656
String bar = "safe!";
57-
java.util.HashMap<String,Object> map95031 = new java.util.HashMap<String,Object>();
58-
map95031.put("keyA-95031", "a Value"); // put some stuff in the collection
59-
map95031.put("keyB-95031", param); // put it in a collection
60-
map95031.put("keyC", "another Value"); // put some stuff in the collection
61-
bar = (String)map95031.get("keyB-95031"); // get it back out
57+
java.util.HashMap<String,Object> map60091 = new java.util.HashMap<String,Object>();
58+
map60091.put("keyA-60091", "a Value"); // put some stuff in the collection
59+
map60091.put("keyB-60091", param); // put it in a collection
60+
map60091.put("keyC", "another Value"); // put some stuff in the collection
61+
bar = (String)map60091.get("keyB-60091"); // get it back out
6262

6363

6464
try {

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00079.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5454

5555

5656
String bar = "safe!";
57-
java.util.HashMap<String,Object> map11273 = new java.util.HashMap<String,Object>();
58-
map11273.put("keyA-11273", "a Value"); // put some stuff in the collection
59-
map11273.put("keyB-11273", param); // put it in a collection
60-
map11273.put("keyC", "another Value"); // put some stuff in the collection
61-
bar = (String)map11273.get("keyB-11273"); // get it back out
57+
java.util.HashMap<String,Object> map37808 = new java.util.HashMap<String,Object>();
58+
map37808.put("keyA-37808", "a Value"); // put some stuff in the collection
59+
map37808.put("keyB-37808", param); // put it in a collection
60+
map37808.put("keyC", "another Value"); // put some stuff in the collection
61+
bar = (String)map37808.get("keyB-37808"); // get it back out
6262

6363

6464
float rand = new java.util.Random().nextFloat();

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00082.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5353
}
5454

5555

56-
StringBuilder sbxyz83953 = new StringBuilder(param);
57-
String bar = sbxyz83953.append("_SafeStuff").toString();
56+
StringBuilder sbxyz31154 = new StringBuilder(param);
57+
String bar = sbxyz31154.append("_SafeStuff").toString();
5858

5959

6060
int randNumber = new java.util.Random().nextInt(99);

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00085.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5454

5555

5656
String bar = "safe!";
57-
java.util.HashMap<String,Object> map95164 = new java.util.HashMap<String,Object>();
58-
map95164.put("keyA-95164", "a Value"); // put some stuff in the collection
59-
map95164.put("keyB-95164", param); // put it in a collection
60-
map95164.put("keyC", "another Value"); // put some stuff in the collection
61-
bar = (String)map95164.get("keyB-95164"); // get it back out
57+
java.util.HashMap<String,Object> map29066 = new java.util.HashMap<String,Object>();
58+
map29066.put("keyA-29066", "a Value"); // put some stuff in the collection
59+
map29066.put("keyB-29066", param); // put it in a collection
60+
map29066.put("keyC", "another Value"); // put some stuff in the collection
61+
bar = (String)map29066.get("keyB-29066"); // get it back out
6262

6363

6464
long l = new java.util.Random().nextLong();

src/main/java/org/owasp/benchmark/testcode/BenchmarkTest00094.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
5454

5555

5656
String bar = "safe!";
57-
java.util.HashMap<String,Object> map60521 = new java.util.HashMap<String,Object>();
58-
map60521.put("keyA-60521", "a_Value"); // put some stuff in the collection
59-
map60521.put("keyB-60521", param); // put it in a collection
60-
map60521.put("keyC", "another_Value"); // put some stuff in the collection
61-
bar = (String)map60521.get("keyB-60521"); // get it back out
62-
bar = (String)map60521.get("keyA-60521"); // get safe value back out
57+
java.util.HashMap<String,Object> map75214 = new java.util.HashMap<String,Object>();
58+
map75214.put("keyA-75214", "a_Value"); // put some stuff in the collection
59+
map75214.put("keyB-75214", param); // put it in a collection
60+
map75214.put("keyC", "another_Value"); // put some stuff in the collection
61+
bar = (String)map75214.get("keyB-75214"); // get it back out
62+
bar = (String)map75214.get("keyA-75214"); // get safe value back out
6363

6464

6565
try {

0 commit comments

Comments
 (0)