Adjust lesson template (#704)
* Remove method `getId()` from all lessons as it defaults to the class name * remove clean up endpoint * remove unused class `RequestParameter` * remove unused class `PluginLoadingFailure` * Move `CourseConfiguration` to lesson package * Add more content around the lesson template lesson and make it visible as a lesson in WebGoat * Remove explicit invocation `trackProgress()` inside WebGoat framework so assignments only need to return an `AttackResult` * Put original solution back as well for SQL string injection * review comments * Add
This commit is contained in:
committed by
René Zubcevic
parent
f40b6ffd31
commit
5dd6b31905
@ -37,9 +37,4 @@ public class HttpBasics extends Lesson {
|
||||
public String getTitle() {
|
||||
return "1.http-basics.title";//first lesson in general
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return "HttpBasics";
|
||||
}
|
||||
}
|
||||
|
@ -24,12 +24,9 @@ package org.owasp.webgoat.http_basics;
|
||||
|
||||
import org.owasp.webgoat.assignments.AssignmentEndpoint;
|
||||
import org.owasp.webgoat.assignments.AssignmentHints;
|
||||
import org.owasp.webgoat.assignments.AssignmentPath;
|
||||
import org.owasp.webgoat.assignments.AttackResult;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@RestController
|
||||
@AssignmentHints({"http-basics.hints.http_basics_lesson.1"})
|
||||
public class HttpBasicsLesson extends AssignmentEndpoint {
|
||||
@ -38,12 +35,12 @@ public class HttpBasicsLesson extends AssignmentEndpoint {
|
||||
@ResponseBody
|
||||
public AttackResult completed(@RequestParam String person) {
|
||||
if (!person.equals("")) {
|
||||
return trackProgress(success()
|
||||
return success(this)
|
||||
.feedback("http-basics.reversed")
|
||||
.feedbackArgs(new StringBuffer(person).reverse().toString())
|
||||
.build());
|
||||
.build();
|
||||
} else {
|
||||
return trackProgress(failed().feedback("http-basics.empty").build());
|
||||
return failed(this).feedback("http-basics.empty").build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,15 +40,15 @@ public class HttpBasicsQuiz extends AssignmentEndpoint {
|
||||
@ResponseBody
|
||||
public AttackResult completed(@RequestParam String answer, @RequestParam String magic_answer, @RequestParam String magic_num, HttpServletRequest request) throws IOException {
|
||||
if ("POST".equals(answer.toUpperCase()) && magic_answer.equals(magic_num)) {
|
||||
return trackProgress(success().build());
|
||||
return success(this).build();
|
||||
} else {
|
||||
if (!"POST".equals(answer.toUpperCase())) {
|
||||
return trackProgress(failed().feedback("http-basics.incorrect").build());
|
||||
return failed(this).feedback("http-basics.incorrect").build();
|
||||
}
|
||||
if (!magic_answer.equals(magic_num)) {
|
||||
return trackProgress(failed().feedback("http-basics.magic").build());
|
||||
return failed(this).feedback("http-basics.magic").build();
|
||||
}
|
||||
}
|
||||
return trackProgress(failed().build());
|
||||
return failed(this).build();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user