We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a5c0f6 commit 9c1d5a7Copy full SHA for 9c1d5a7
java/ql/test/query-tests/security/CWE-079/semmle/tests/SpringXSS.java
@@ -5,6 +5,7 @@
5
import org.springframework.web.bind.annotation.PostMapping;
6
import org.springframework.web.bind.annotation.RequestMapping;
7
import org.springframework.web.bind.annotation.RestController;
8
+import org.springframework.web.util.HtmlUtils;
9
10
import java.util.Optional;
11
@@ -157,4 +158,9 @@ public static String stringWithNoMediaType(String userControlled) {
157
158
return userControlled; // $xss
159
}
160
-}
161
+ @GetMapping(value = "/abc")
162
+ public static String sanitizedString(String userControlled) {
163
+ return HtmlUtils.htmlEscape(userControlled);
164
+ }
165
+
166
+}
0 commit comments