Skip to content

Commit

Permalink
XWIKI-22734: Improve the standard query validator
Browse files Browse the repository at this point in the history
* fix regression
  • Loading branch information
tmortagne committed Dec 20, 2024
1 parent d96fd64 commit 56e303f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private boolean isNodeSafe(Node node)

private boolean isFunctionSafe(Function function)
{
return ALLOWED_FUNCTIONS.contains(function.getName());
return ALLOWED_FUNCTIONS.contains(function.getName().toLowerCase());
}

private Map<String, String> getTables(PlainSelect plainSelect)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ void safe()
assertSafe("select doc.fullName from XWikiDocument as doc, com.xpn.xwiki.objects.StringProperty as str");

assertSafe("select count(*) from XWikiSpace");
assertSafe("select COUNT(*) from XWikiSpace");
assertSafe("select count(space.*) from XWikiSpace space");

assertSafe("select attachment.filename from XWikiAttachment attachment");
assertSafe("select count(*) from XWikiAttachment");

assertSafe("select name from XWikiDocument where lower(name)='name'");
assertSafe("select name from XWikiDocument where LOWER(name)='name'");

assertSafe("select doc.fullName from XWikiDocument doc where doc.name = :name");
}
Expand Down

0 comments on commit 56e303f

Please sign in to comment.