Create a deny list to reject webshell tokens (OFBIZ-12324)

Replace java 9 `List.of` that is not yet compatible with current CI java
configuration (java 8)
This commit is contained in:
Gil Portenseigne
2021-09-23 15:30:42 +02:00
parent c0f8783d8d
commit 3cea95fc4c
@@ -59,8 +59,10 @@ public class SecurityUtilTest {
@Test
public void webShellTokensTesting() {
try {
assertTrue(SecuredUpload.isValidText("hack.getFileName", List.of("getfilename")));
List<String> allowed = new ArrayList<>();
allowed.add("getfilename");
assertTrue(SecuredUpload.isValidText("hack.getFileName", allowed));
allowed = new ArrayList<>();
assertFalse(SecuredUpload.isValidText("hack.getFileName", allowed));
assertFalse(SecuredUpload.isValidText("freemarker", allowed));
assertFalse(SecuredUpload.isValidText("import=\"java", allowed));