relax detection regex (#757)

Allow for content before and after the script; Allow optional semicolon
This commit is contained in:
August Detlefsen 2020-02-20 11:00:07 -08:00 committed by GitHub
parent cd3fb8040f
commit 208aa42fdb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ public class CrossSiteScriptingLesson5a extends AssignmentEndpoint {
@RequestParam Integer QTY4, @RequestParam String field1, @RequestParam Integer QTY4, @RequestParam String field1,
@RequestParam String field2) { @RequestParam String field2) {
if (field2.toLowerCase().matches("<script>.*(console\\.log\\(.*\\)|alert\\(.*\\))<\\/script>")) { if (field2.toLowerCase().matches(".*<script>.*(console\\.log\\(.*\\)|alert\\(.*\\));?<\\/script>.*")) {
return failed(this).feedback("xss-reflected-5a-failed-wrong-field").build(); return failed(this).feedback("xss-reflected-5a-failed-wrong-field").build();
} }