Graylog2/graylog2-server

Get index sets API returns 404 if skip or limit parameter is invalid. 400 should be returned.

Open

#4721 opened on Apr 13, 2018

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Java (6,945 stars) (1,032 forks)batch import
buggood first issuetriaged

Description

Get index sets API (GET /system/indices/index_sets) returns 404 error if skip or limit parameter is invalid, although it should return 400 error.

Expected Behavior

Get index sets API (GET /system/indices/index_sets) returns 400 error and appropriate error message if skip or limit parameter is invalid.

Current Behavior

HTTP status code: 404

{
  "type": "ApiError",
  "message": "HTTP 404 Not Found"
}

Possible Solution

Steps to Reproduce (for bugs)

Run a Get Index Sets API request whose skip or limit parameter is invalid. It is convenient to use the API browser.

http://localhost:9000/api/api-browser#!/System/IndexSets/list_get_0

  • skip: "hoge" (not integer)
  • limit: 0
  • stats: false
http://127.0.0.1:9000/api/system/indices/index_sets?skip=hoge&limit=0&stats=false

Or

  • skip: 0
  • limit: "hoge" (not integer)
  • stats: false
http://127.0.0.1:9000/api/system/indices/index_sets?skip=0&limit=hoge&stats=false

Context

Your Environment

  • Graylog Version: 2.4.3-1
  • Elasticsearch Version: 5.6.3
  • MongoDB Version: 3
  • Operating System: Mac OS X
  • Browser version: Google Chrome 65.0.3325.162 (Official Build) (64 bit)

Here is the docker-compose.yml which I use.

---
version: '2'
services:
  # MongoDB: https://hub.docker.com/_/mongo/
  mongodb:
    image: mongo:3
  # Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/docker.html
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.6.3
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      # Disable X-Pack security: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/security-settings.html#general-security-settings
      - xpack.security.enabled=false
      - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 2g
  # Graylog: https://hub.docker.com/r/graylog/graylog/
  graylog:
    image: graylog/graylog:2.4.3-1
    environment:
      # CHANGE ME!
      - GRAYLOG_PASSWORD_SECRET=somepasswordpepper
      # Password: admin
      - GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
      - GRAYLOG_WEB_ENDPOINT_URI=http://127.0.0.1:9000/api
    links:
      - mongodb:mongo
      - elasticsearch
    depends_on:
      - mongodb
      - elasticsearch
    ports:
      # Graylog web interface and REST API
      - 9000:9000
      # GELF TCP
      - 12201:12201
      # GELF UDP
      - 12201:12201/udp

Contributor guide