New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not allow limit=0 or limit>maximun in distinct requests #1007

Merged
merged 2 commits into from Jul 27, 2018

Conversation

Projects
2 participants
@Lifka
Member

Lifka commented Jul 27, 2018

Hi,

this PR fixes the issue #1006.

Sample

$ curl -u foo:bar -k "http://127.0.0.1:55000/agents/stats/distinct?pretty&limit=10000"
{
   "error": 1405,
   "message": "Specified limit exceeds maximum allowed (1000): 10000"
}

$ curl -u foo:bar -k "http://127.0.0.1:55000/agents/stats/distinct?pretty&limit=0"
{
   "error": 1406,
   "message": "0 is not a valid limit."
}

$ curl -u foo:bar -k "http://127.0.0.1:55000/agents/stats/distinct?pretty&limit=1"
{
   "error": 0,
   "data": {
      "totalItems": 4,
      "items": [
         {
            "count": 1,
            "version": "Wazuh v3.5.0",
            "group": null,
            "manager_host": "manager",
            "os": {
               "major": "7",
               "name": "CentOS Linux",
               "uname": "Linux |manager |3.10.0-693.21.1.el7.x86_64 |#1 SMP Wed Mar 7 19:03:37 UTC 2018 |x86_64",
               "platform": "centos",
               "version": "7",
               "build": null,
               "codename": "Core",
               "arch": "x86_64",
               "minor": null
            },
            "node_name": "node01"
         }
      ]
   }
}

Regards,
Javi.

@Lifka Lifka added this to Needs review in Wazuh 3.5 via automation Jul 27, 2018

@Lifka Lifka requested a review from mgmacias95 Jul 27, 2018

@jesuslinares jesuslinares merged commit 50d2922 into 3.5 Jul 27, 2018

Wazuh 3.5 automation moved this from Needs review to Done Jul 27, 2018

@jesuslinares jesuslinares deleted the fix-distinct-agents-limit branch Jul 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment