Skip to content

Commit 603ef15

Browse files
committed
XWIKI-22718, XWIKI-22691: Improve query validation
* add more tests (cherry picked from commit d6fafbc)
1 parent a4c4da4 commit 603ef15

File tree

1 file changed

+8
-2
lines changed
  • xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/store/hibernate/query

1 file changed

+8
-2
lines changed

xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/internal/store/hibernate/query/HqlQueryUtilsTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@ public void isSafe()
6363
.isSafe("select doc.name, ot.field from XWikiDocument doc, XWikiSpace space, OtherTable as ot"));
6464
assertFalse(HqlQueryUtils.isSafe("select count(*) from OtherTable"));
6565
assertFalse(HqlQueryUtils.isSafe("select count(other.*) from OtherTable other"));
66-
assertFalse(HqlQueryUtils.isSafe("select doc.fullName from XWikiDocument doc union all select name from OtherTable"));
67-
assertFalse(HqlQueryUtils.isSafe("select doc.fullName from XWikiDocument doc where 1<>'1\\'' union select name from OtherTable #'"));
66+
assertFalse(
67+
HqlQueryUtils.isSafe("select doc.fullName from XWikiDocument doc union all select name from OtherTable"));
68+
assertFalse(HqlQueryUtils
69+
.isSafe("select doc.fullName from XWikiDocument doc where 1<>'1\\'' union select name from OtherTable #'"));
70+
assertFalse(HqlQueryUtils.isSafe(
71+
"select doc.fullName from XWikiDocument doc where $$='$$=concat( chr( 61 ),(chr( 39 )) ) ;select 1 -- comment'"));
72+
assertFalse(HqlQueryUtils.isSafe(
73+
"select doc.fullName from XWikiDocument doc where NVL(TO_CHAR(DBMS_XMLGEN.getxml('select 1 where 1337>1')),'1')!='1'"));
6874
}
6975

7076
@Test

0 commit comments

Comments
 (0)