Skip to content

Commit ac410be

Browse files
unknownunknown
authored andcommitted
Fix WEB-151 - tolerate missing user cookie attribute in challenge stage2
1 parent 3fd7b34 commit ac410be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main/java/org/owasp/webgoat/lessons/Challenge2Screen.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,12 @@ protected Element doStage2(WebSession s) throws Exception
210210
.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
211211

212212
// pull the USER_COOKIE from the cookies
213-
String cookie = URLDecoder.decode(getCookie(s),"utf-8");
213+
String cookie = getCookie(s);
214+
if (null == cookie) {
215+
cookie = "";
216+
} else {
217+
cookie = URLDecoder.decode(cookie,"utf-8");
218+
}
214219

215220
String user = Encoding.base64Decode(cookie);
216221
String query = "SELECT * FROM user_data WHERE last_name = '" + user + "'";

0 commit comments

Comments
 (0)