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

PuppetDB returns 500 error as HTML when query contains invalid regex

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PDB 2.2.0
    • Fix Version/s: PDB 3.0.0
    • Component/s: PE
    • Labels:
      None
    • Template:
    • Story Points:
      0
    • Sprint:
      PuppetDB 2014-11-19, PuppetDB 2014-12-03, PuppetDB 2014-12-17, PuppetDB 2014-12-31, PuppetDB 2015-01-14, PuppetDB 2015-01-28, PuppetDB 2015-02-11, PuppetDB 2015-02-25

      Description

      Entering an invalid regex pattern in a query causes PuppetDB to return a 500 error as `text/html`

      Request:

      curl -v 'http://localhost:8080/v3/nodes/kb.local/facts?query=\["~","name","*.foo"\]&include-total=true&limit=1'
      

      Response:

      HTTP/1.1 500 org.postgresql.util.PSQLException: ERROR: invalid regular expression: quantifier operand invalid
      Cache-Control: must-revalidate,no-cache,no-store
      Connection: close
      Content-Length: 373
      Content-Type: text/html; charset=ISO-8859-1
      Date: Fri, 10 Oct 2014 17:43:35 GMT
      Server: Jetty(9.1.z-SNAPSHOT)
       
      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
      <title>Error 500 </title>
      </head>
      <body>
      <h2>HTTP ERROR: 500</h2>
      <p>Problem accessing /v3/nodes. Reason:
      <pre>    org.postgresql.util.PSQLException: ERROR: invalid regular expression: quantifier operand invalid</pre></p>
      <hr /><i><small>Powered by Jetty://</small></i>
      </body>
      </html>
      

      I would be nicer (for the NC UI for instance) if this were handled better and returned as JSON.

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                demonshi Andrii Nikitiuk
                Reporter:
                steve Steve Axthelm
                QA Contact:
                Erik Dasher
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: