#1045: Run build with Java 16
This commit is contained in:
@ -11,21 +11,20 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
<version>2.3.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock</artifactId>
|
||||
<version>2.27.2</version>
|
||||
<scope>test</scope>
|
||||
<scope>test</scope>
|
||||
<version>${wiremock.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
@ -23,6 +23,7 @@
|
||||
package org.owasp.webgoat.xxe;
|
||||
|
||||
import org.apache.commons.exec.OS;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.owasp.webgoat.assignments.AssignmentEndpoint;
|
||||
import org.owasp.webgoat.assignments.AssignmentHints;
|
||||
import org.owasp.webgoat.assignments.AttackResult;
|
||||
@ -67,17 +68,17 @@ public class ContentTypeAssignment extends AssignmentEndpoint {
|
||||
if (null != contentType && contentType.contains(MediaType.APPLICATION_XML_VALUE)) {
|
||||
String error = "";
|
||||
try {
|
||||
boolean secure = false;
|
||||
if (null != request.getSession().getAttribute("applySecurity")) {
|
||||
secure = true;
|
||||
}
|
||||
boolean secure = false;
|
||||
if (null != request.getSession().getAttribute("applySecurity")) {
|
||||
secure = true;
|
||||
}
|
||||
Comment comment = comments.parseXml(commentStr, secure);
|
||||
comments.addComment(comment, false);
|
||||
if (checkSolution(comment)) {
|
||||
attackResult = success(this).build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
error = org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace(e);
|
||||
error = ExceptionUtils.getStackTrace(e);
|
||||
attackResult = failed(this).feedback("xxe.content.type.feedback.xml").output(error).build();
|
||||
}
|
||||
}
|
||||
@ -85,13 +86,13 @@ public class ContentTypeAssignment extends AssignmentEndpoint {
|
||||
return attackResult;
|
||||
}
|
||||
|
||||
private boolean checkSolution(Comment comment) {
|
||||
String[] directoriesToCheck = OS.isFamilyMac() || OS.isFamilyUnix() ? DEFAULT_LINUX_DIRECTORIES : DEFAULT_WINDOWS_DIRECTORIES;
|
||||
boolean success = false;
|
||||
for (String directory : directoriesToCheck) {
|
||||
success |= org.apache.commons.lang3.StringUtils.contains(comment.getText(), directory);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
private boolean checkSolution(Comment comment) {
|
||||
String[] directoriesToCheck = OS.isFamilyMac() || OS.isFamilyUnix() ? DEFAULT_LINUX_DIRECTORIES : DEFAULT_WINDOWS_DIRECTORIES;
|
||||
boolean success = false;
|
||||
for (String directory : directoriesToCheck) {
|
||||
success |= org.apache.commons.lang3.StringUtils.contains(comment.getText(), directory);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
package org.owasp.webgoat.xxe;
|
||||
|
||||
import org.apache.commons.exec.OS;
|
||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.owasp.webgoat.assignments.AssignmentEndpoint;
|
||||
import org.owasp.webgoat.assignments.AssignmentHints;
|
||||
import org.owasp.webgoat.assignments.AttackResult;
|
||||
@ -80,7 +80,7 @@ public class SimpleXXE extends AssignmentEndpoint {
|
||||
return success(this).build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
error = ExceptionUtils.getFullStackTrace(e);
|
||||
error = ExceptionUtils.getStackTrace(e);
|
||||
}
|
||||
return failed(this).output(error).build();
|
||||
}
|
||||
|
Reference in New Issue
Block a user