FIx?
This commit is contained in:
@ -87,7 +87,6 @@ public class GeneralLessonTest extends IntegrationTest {
|
||||
.get(url("/WebGoat/HttpProxies/intercept-request?changeMe=Requests are tampered easily")).then()
|
||||
.statusCode(200).extract().path("lessonCompleted"), CoreMatchers.is(true));
|
||||
checkResults("/HttpProxies/");
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -31,6 +31,11 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
public class HttpBasicsInterceptRequest extends AssignmentEndpoint {
|
||||
|
||||
// @ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
// public AttackResult handleMissingParams() {
|
||||
// return trackProgress(failed().feedback("http-proxies.intercept.failure").build());
|
||||
// }
|
||||
|
||||
@GetMapping("/HttpProxies/intercept-request")
|
||||
@ResponseBody
|
||||
public AttackResult completed(@RequestHeader(value = "x-request-intercepted", required = false) Boolean headerValue,
|
||||
@ -42,14 +47,9 @@ public class HttpBasicsInterceptRequest extends AssignmentEndpoint {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/HttpProxies/intercept-request")
|
||||
@ResponseBody
|
||||
public AttackResult post() {
|
||||
return trackProgress(failed().feedback("http-proxies.intercept.failure").build());
|
||||
}
|
||||
|
||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
public AttackResult handleMissingParams() {
|
||||
return trackProgress(failed().feedback("http-proxies.intercept.failure").build());
|
||||
}
|
||||
// @PostMapping("/HttpProxies/intercept-request")
|
||||
// @ResponseBody
|
||||
// public AttackResult post() {
|
||||
// return trackProgress(failed().feedback("http-proxies.intercept.failure").build());
|
||||
// }
|
||||
}
|
||||
|
@ -88,13 +88,13 @@ public class HttpBasicsInterceptRequestTest extends AssignmentEndpointTest {
|
||||
.andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void whenPostAssignmentShouldNotPass() throws Exception {
|
||||
mockMvc.perform(MockMvcRequestBuilders.post("/HttpProxies/intercept-request")
|
||||
.header("x-request-intercepted", "true")
|
||||
.param("changeMe", "Requests are tampered easily"))
|
||||
.andExpect(status().isOk())
|
||||
.andExpect(jsonPath("$.feedback", CoreMatchers.is(messages.getMessage("http-proxies.intercept.failure"))))
|
||||
.andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
|
||||
}
|
||||
// @Test
|
||||
// public void whenPostAssignmentShouldNotPass() throws Exception {
|
||||
// mockMvc.perform(MockMvcRequestBuilders.post("/HttpProxies/intercept-request")
|
||||
// .header("x-request-intercepted", "true")
|
||||
// .param("changeMe", "Requests are tampered easily"))
|
||||
// .andExpect(status().isOk())
|
||||
// .andExpect(jsonPath("$.feedback", CoreMatchers.is(messages.getMessage("http-proxies.intercept.failure"))))
|
||||
// .andExpect(jsonPath("$.lessonCompleted", CoreMatchers.is(false)));
|
||||
// }
|
||||
}
|
Reference in New Issue
Block a user