Fixed XXE lesson the posting of the comments did not show up directly only after page refresh
This commit is contained in:
parent
157b982394
commit
75d0405da1
@ -19,8 +19,10 @@ import javax.xml.stream.XMLStreamReader;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static java.util.Optional.empty;
|
import static java.util.Optional.empty;
|
||||||
import static java.util.Optional.of;
|
import static java.util.Optional.of;
|
||||||
@ -54,7 +56,7 @@ public class Comments {
|
|||||||
allComments.addAll(xmlComments);
|
allComments.addAll(xmlComments);
|
||||||
}
|
}
|
||||||
allComments.addAll(comments);
|
allComments.addAll(comments);
|
||||||
return allComments;
|
return allComments.stream().sorted(Comparator.comparing(Comment::getDateTime).reversed()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Comment parseXml(String xml) throws Exception {
|
protected Comment parseXml(String xml) throws Exception {
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
method="POST" name="form"
|
method="POST" name="form"
|
||||||
prepareData="simpleXXE"
|
prepareData="simpleXXE"
|
||||||
successCallback="simpleXXECallback"
|
successCallback="simpleXXECallback"
|
||||||
|
failureCallback="simpleXXECallback"
|
||||||
contentType="application/xml"
|
contentType="application/xml"
|
||||||
action="/WebGoat/xxe/simple">
|
action="/WebGoat/xxe/simple">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -82,6 +83,7 @@
|
|||||||
method="POST" name="form"
|
method="POST" name="form"
|
||||||
prepareData="contentTypeXXE"
|
prepareData="contentTypeXXE"
|
||||||
successCallback="contentTypeXXECallback"
|
successCallback="contentTypeXXECallback"
|
||||||
|
failureCallback="contentTypeXXECallback"
|
||||||
action="xxe/content-type"
|
action="xxe/content-type"
|
||||||
contentType="application/json">
|
contentType="application/json">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
@ -147,6 +149,7 @@
|
|||||||
method="POST" name="form"
|
method="POST" name="form"
|
||||||
prepareData="blindXXE"
|
prepareData="blindXXE"
|
||||||
successCallback="blindXXECallback"
|
successCallback="blindXXECallback"
|
||||||
|
failureCallback="blindXXECallback"
|
||||||
action="/WebGoat/xxe/blind"
|
action="/WebGoat/xxe/blind"
|
||||||
contentType="application/xml">
|
contentType="application/xml">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
|
@ -8,7 +8,7 @@ webgoat.customjs.simpleXXE = function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
webgoat.customjs.simpleXXECallback = function() {
|
webgoat.customjs.simpleXXECallback = function() {
|
||||||
$("#commentInputBlind").val('');
|
$("#commentInputSimple").val('');
|
||||||
getComments('#commentsListSimple');
|
getComments('#commentsListSimple');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -16,6 +16,25 @@ $(document).ready(function () {
|
|||||||
getComments('#commentsListSimple');
|
getComments('#commentsListSimple');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//// Content-type
|
||||||
|
|
||||||
|
webgoat.customjs.contentTypeXXE = function() {
|
||||||
|
var commentInput = $("#commentInputContentType").val();
|
||||||
|
return JSON.stringify({text: commentInput});
|
||||||
|
}
|
||||||
|
|
||||||
|
webgoat.customjs.contentTypeXXECallback = function() {
|
||||||
|
$("#commentInputContentType").val('');
|
||||||
|
getComments('#commentsListContentType');
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
getComments('#commentsListContentType');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
//// Blind
|
||||||
|
|
||||||
webgoat.customjs.blindXXE = function() {
|
webgoat.customjs.blindXXE = function() {
|
||||||
var commentInput = $("#commentInputBlind").val();
|
var commentInput = $("#commentInputBlind").val();
|
||||||
var xml = '<?xml version="1.0"?>' +
|
var xml = '<?xml version="1.0"?>' +
|
||||||
@ -34,19 +53,7 @@ $(document).ready(function () {
|
|||||||
getComments('#commentsListBlind');
|
getComments('#commentsListBlind');
|
||||||
});
|
});
|
||||||
|
|
||||||
webgoat.customjs.contentTypeXXE = function() {
|
|
||||||
var commentInput = $("#commentInputContentType").val();
|
|
||||||
return JSON.stringify({text: commentInput});
|
|
||||||
}
|
|
||||||
|
|
||||||
webgoat.customjs.contentTypeXXECallback = function() {
|
|
||||||
$("#commentInputContentType").val('');
|
|
||||||
getComments('#commentsListContentType');
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
|
||||||
getComments('#commentsListContentType');
|
|
||||||
});
|
|
||||||
|
|
||||||
var html = '<li class="comment">' +
|
var html = '<li class="comment">' +
|
||||||
'<div class="pull-left">' +
|
'<div class="pull-left">' +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user