Uploaded image for project: 'PuppetDB'
  1. PuppetDB
  2. PDB-4731

Misspelled query modifiers like groupy_by can result in all results being returned

    XMLWordPrintable

Details

      • Mispelled operators like group_by, order_by, limit error
    • Ghost
    • 5
    • ghost-08.09.2021, ghost-22.09.2021, ghost-6.10.2021
    • Manual Test
    • Bug Fix
    • Hide
      If a query with an extract clause contains a misspelled option, the clause is completely ignored resulting in a misleading response body.
      Eg. ["from", "reports", ["extract", [["function", "count", "certname"]], ["null?", "type", false], ["groupy_by", "certname"]]]
      will return all the reports because the extract will be ignored ( it contains groupy_by instead of group_by).
       
      Instead of returning nil for a malformed extract clause (when converting the query to sql plan), try to identify the misspelled part and log an appropriate error message.
      Show
      If a query with an extract clause contains a misspelled option, the clause is completely ignored resulting in a misleading response body. Eg. ["from", "reports", ["extract", [["function", "count", "certname"]], ["null?", "type", false], ["groupy_by", "certname"]]] will return all the reports because the extract will be ignored ( it contains groupy_by instead of group_by).   Instead of returning nil for a malformed extract clause (when converting the query to sql plan), try to identify the misspelled part and log an appropriate error message.
    • Needs Assessment

    Description

      An AST query like

      curl -X POST http://localhost:8080/pdb/query/v4   -H 'Content-Type:application/json'   -d '{"query": ["from", "reports", ["extract", [["function", "count", "certname"]], ["null?", "type", false], ["groupy_by", "certname"]]] }' | jq
      

      should error because the operator groupy_by is misspelled.

      Instead, it ignores the entire ["extract" ... filter and returns the results of the query ["from", "reports"].

      Attachments

        Activity

          People

            oana.tanasoiu Oana Tanasoiu
            austin.blatt Austin Blatt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support