You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "thomasmueller (via GitHub)" <gi...@apache.org> on 2023/09/06 09:55:49 UTC

[GitHub] [jackrabbit-oak] thomasmueller commented on a diff in pull request #1094: OAK-10424 add support for INSECURE RESULT SIZE and INSECURE FACETS query options and rep:insecureQueryOptions privilege

thomasmueller commented on code in PR #1094:
URL: https://github.com/apache/jackrabbit-oak/pull/1094#discussion_r1317041436


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/query/SQL2Parser.java:
##########
@@ -234,6 +249,28 @@ public Query parse(final String query, final boolean initialise) throws ParseExc
 
         return q;
     }
+
+    /**
+     * Checks the InsecureQueryOptionsMode for the values ALLOW or DENY. If allowed, the method returns true,
+     * indicating that insecure options should be returned by the parser. If denied, a ParseException is thrown.
+     * For all other modes, the method returns false, indicating that this option should be ignored.
+     *
+     * @return true if the mode is ALLOW, false otherwise
+     * @throws ParseException if the mode is DENY
+     */
+    private boolean allowsInsecureOptions() throws ParseException {

Review Comment:
   I think checking (and throwing the exception) need to happen at execution time, not while parsing.



##########
oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryOptions.java:
##########
@@ -106,6 +110,14 @@ public QueryOptions(QueryOptions defaultValues) {
             t.read(']');
             prefetch = list;
         }
+        x = map.get("insecureResultSize");
+        if (x != null) {

Review Comment:
   I think the following should work:
   
       insecureResultSize = Boolean.parseBoolean(map.get("insecureResultSize"))



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org