Skip to content

Commit 3814b35

Browse files
committed
Merge pull request #13 from TomConner/next
Fix WEB-151 - tolerate missing user cookie attribute in challenge stage2
2 parents b53094b + ac410be commit 3814b35

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)