Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-7117

Query parameter validation should return an explicit error when skip value is a negative integer

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.0
    • 2.0
    • view-engine
    • Security Level: Public
    • None
    • latest cluster run

    Description

      Steps to reproduce:

      1. Install beer-sample database
      2. Go to view 'brewery_beers' and while doing view query change the skip to -2(a negative number).
      Attached page is displayed which shows webpage is unavailable. We can change it to something similar when limit is negative e.g.

      {"error":"query_parse_error","reason":"Invalid value for positive integer parameter: \"-10\""}

      negative LIMIT Query
      bash> curl -v -s 'http://127.0.0.1:9500/beer-sample/_design/beer/_view/brewery_beers?connection_timeout=60000&skip=2&limit=-10'

      • About to connect() to 127.0.0.1 port 9500 (#0)
      • Trying 127.0.0.1... connected
      • Connected to 127.0.0.1 (127.0.0.1) port 9500 (#0)
        > GET /beer-sample/_design/beer/_view/brewery_beers?connection_timeout=60000&skip=2&limit=-10 HTTP/1.1
        > User-Agent: curl/7.21.4 (x86_64-unknown-linux-gnu) libcurl/7.21.4 OpenSSL/1.0.1 zlib/1.2.3.4
        > Host: 127.0.0.1:9500
        > Accept: /
        >
        < HTTP/1.1 400 Bad Request
        < Server: MochiWeb/1.0 (Any of you quaids got a smint?)
        < Date: Wed, 07 Nov 2012 10:04:14 GMT
        < Content-Type: text/plain;charset=utf-8
        < Content-Length: 95
        < Cache-Control: must-revalidate
        < {"error":"query_parse_error","reason":"Invalid value for positive integer parameter: \"-10\""}
      • Connection #0 to host 127.0.0.1 left intact
      • Closing connection #0

      negative SKIP Query
      bash> curl -v -s 'http://127.0.0.1:9500/beer-sample/_design/beer/_view/brewery_beers?connection_timeout=60000&skip=-2&limit=10'

      • About to connect() to 127.0.0.1 port 9500 (#0)
      • Trying 127.0.0.1... connected
      • Connected to 127.0.0.1 (127.0.0.1) port 9500 (#0)
        > GET /beer-sample/_design/beer/_view/brewery_beers?connection_timeout=60000&skip=-2&limit=10 HTTP/1.1
        > User-Agent: curl/7.21.4 (x86_64-unknown-linux-gnu) libcurl/7.21.4 OpenSSL/1.0.1 zlib/1.2.3.4
        > Host: 127.0.0.1:9500
        > Accept: /
        >
        < HTTP/1.1 200 OK
        < Transfer-Encoding: chunked
        < Server: MochiWeb/1.0 (Any of you quaids got a smint?)
        < Date: Wed, 07 Nov 2012 10:03:58 GMT
        < Content-Type: text/plain;charset=utf-8
        < Cache-Control: must-revalidate
        <
      • Received problem 2 in the chunky parser
      • Closing connection #0

      Attachments

        For Gerrit Dashboard: MB-7117
        # Subject Branch Project Status CR V

        Activity

          People

            FilipeManana Filipe Manana (Inactive)
            deepkaran.salooja Deepkaran Salooja
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty