Code style (#696)
* Remove Guava dependency from WebGoat * Add Checkstyle to the project with very basic standards so we have a style across lessons. It does not interfere with basic Intellij formatting
This commit is contained in:
committed by
René Zubcevic
parent
66bd1d8c1a
commit
1a83e2825e
@ -35,24 +35,18 @@ public class BypassRestrictionsFieldRestrictions extends AssignmentEndpoint {
|
||||
@PostMapping("/BypassRestrictions/FieldRestrictions")
|
||||
@ResponseBody
|
||||
public AttackResult completed(@RequestParam String select, @RequestParam String radio, @RequestParam String checkbox, @RequestParam String shortInput) {
|
||||
if (select.equals("option1") || select.equals("option2")) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (radio.equals("option1") || radio.equals("option2")) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (checkbox.equals("on") || checkbox.equals("off")) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (shortInput.length() <= 5) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
/*if (disabled == null) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (submit.toString().equals("submit")) {
|
||||
return trackProgress(failed().build());
|
||||
}*/
|
||||
if (select.equals("option1") || select.equals("option2")) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (radio.equals("option1") || radio.equals("option2")) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (checkbox.equals("on") || checkbox.equals("off")) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
if (shortInput.length() <= 5) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
return trackProgress(success().build());
|
||||
}
|
||||
}
|
||||
|
@ -36,13 +36,13 @@ public class BypassRestrictionsFrontendValidation extends AssignmentEndpoint {
|
||||
@PostMapping("/BypassRestrictions/frontendValidation")
|
||||
@ResponseBody
|
||||
public AttackResult completed(@RequestParam String field1, @RequestParam String field2, @RequestParam String field3, @RequestParam String field4, @RequestParam String field5, @RequestParam String field6, @RequestParam String field7, @RequestParam Integer error) {
|
||||
String regex1 = "^[a-z]{3}$";
|
||||
String regex2 = "^[0-9]{3}$";
|
||||
String regex3 = "^[a-zA-Z0-9 ]*$";
|
||||
String regex4 = "^(one|two|three|four|five|six|seven|eight|nine)$";
|
||||
String regex5 = "^\\d{5}$";
|
||||
String regex6 = "^\\d{5}(-\\d{4})?$";
|
||||
String regex7 = "^[2-9]\\d{2}-?\\d{3}-?\\d{4}$";
|
||||
final String regex1 = "^[a-z]{3}$";
|
||||
final String regex2 = "^[0-9]{3}$";
|
||||
final String regex3 = "^[a-zA-Z0-9 ]*$";
|
||||
final String regex4 = "^(one|two|three|four|five|six|seven|eight|nine)$";
|
||||
final String regex5 = "^\\d{5}$";
|
||||
final String regex6 = "^\\d{5}(-\\d{4})?$";
|
||||
final String regex7 = "^[2-9]\\d{2}-?\\d{3}-?\\d{4}$";
|
||||
if (error > 0) {
|
||||
return trackProgress(failed().build());
|
||||
}
|
||||
|
Reference in New Issue
Block a user