Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-19198

API validation missing for outdated API call

    XMLWordPrintable

Details

    • Incident report
    • Status: Confirmed
    • Major
    • Resolution: Unresolved
    • 5.0.10
    • None
    • API (A)

    Description

      After running a specific API call validation is missing.

      API call in question:

        {
          "jsonrpc": "2.0",
          "method": "action.update",
          "params": {
            "operations": [
              {
                "opmessage_usr": [
                  {
                    "userid": "1"
                  }
                ],
                "operationtype": "0",
                "opmessage": {
                  "mediatypeid": "0",
                  "default_msg": "1"
                },
                "opconditions": [],
                "esc_step_to": "1",
                "esc_step_from": "1"
              }
            ],
            "def_shortdata": "trigger",
            "ack_shortdata": "acknowledge",
            "acknowledge_operations": [
              {
                "opmessage": {
                  "mediatypeid": "0",
                  "default_msg": "1"
                },
                "opmessage_usr": [
                  {
                    "userid": "1"
                  }
                ],
                "operationtype": "0"
              }
            ],
            "def_longdata": "name:{EVENT.NAME}",
            "recovery_operations": [
              {
                "opmessage": {
                  "mediatypeid": "0",
                  "default_msg": "1"
                },
                "opmessage_usr": [
                  {
                    "userid": "1"
                  }
                ],
                "operationtype": "0"
              }
            ],
            "actionid": "15",
            "ack_longdata": "name:{EVENT.NAME}",
            "r_shortdata": "resolve",
            "r_longdata": "name:{EVENT.NAME}"
          },
          "auth": "8b6e7b6ede4c99175650c8ef59060aa6",
          "id": 1
        }
       

      Instead of an error about incorrect parameters, Zabbix returns error:
      Cannot perform update statement on table \"actions\" without values

        {
          "jsonrpc": "2.0",
          "error": {
            "code": -32500,
            "message": "Application error.",
            "data": "Cannot perform update statement on table \"actions\" without values.",
            "debug": [
              {
                "file": "/usr/share/zabbix/include/classes/db/DB.php",
                "line": 576,
                "function": "exception",
                "class": "DB",
                "type": "::",
                "args": [
                  1,
                  "Cannot perform update statement on table \"actions\" without values."
                ]
              },
              {
                "file": "/usr/share/zabbix/include/classes/api/services/CAction.php",
                "line": 927,
                "function": "update",
                "class": "DB",
                "type": "::",
                "args": [
                  "actions",
                  [
                    {
                      "values": {
                        "def_shortdata": "trigger",
                        "ack_shortdata": "acknowledge",
                        "def_longdata": "name:{EVENT.NAME}",
                        "ack_longdata": "name:{EVENT.NAME}",
                        "r_shortdata": "resolve",
                        "r_longdata": "name:{EVENT.NAME}"
                      },
                      "where": {
                        "actionid": 15
                      }
                    }
                  ]
                ]
              },
              {
                "file": "/usr/share/zabbix/include/classes/api/clients/CLocalApiClient.php",
                "line": 123,
                "function": "update",
                "class": "CAction",
                "type": "->",
                "args": [
                  {
                    "15": {
                      "operations": [
                        {
                          "opmessage_usr": [
                            {
                              "userid": "1"
                            }
                          ],
                          "operationtype": "0",
                          "opmessage": {
                            "mediatypeid": "0",
                            "default_msg": "1"
                          },
                          "opconditions": [],
                          "esc_step_to": "1",
                          "esc_step_from": "1"
                        }
                      ],
                      "def_shortdata": "trigger",
                      "ack_shortdata": "acknowledge",
                      "acknowledge_operations": [
                        {
                          "opmessage": {
                            "mediatypeid": "0",
                            "default_msg": "1"
                          },
                          "opmessage_usr": [
                            {
                              "userid": "1"
                            }
                          ],
                          "operationtype": "0"
                        }
                      ],
                      "def_longdata": "name:{EVENT.NAME}",
                      "recovery_operations": [
                        {
                          "opmessage": {
                            "mediatypeid": "0",
                            "default_msg": "1"
                          },
                          "opmessage_usr": [
                            {
                              "userid": "1"
                            }
                          ],
                          "operationtype": "0"
                        }
                      ],
                      "actionid": "15",
                      "ack_longdata": "name:{EVENT.NAME}",
                      "r_shortdata": "resolve",
                      "r_longdata": "name:{EVENT.NAME}"
                    }
                  }
                ]
              },
              {
                "file": "/usr/share/zabbix/include/classes/core/CJsonRpc.php",
                "line": 85,
                "function": "callMethod",
                "class": "CLocalApiClient",
                "type": "->",
                "args": [
                  "action",
                  "update",
                  {
                    "operations": [
                      {
                        "opmessage_usr": [
                          {
                            "userid": "1"
                          }
                        ],
                        "operationtype": "0",
                        "opmessage": {
                          "mediatypeid": "0",
                          "default_msg": "1"
                        },
                        "opconditions": [],
                        "esc_step_to": "1",
                        "esc_step_from": "1"
                      }
                    ],
                    "def_shortdata": "trigger",
                    "ack_shortdata": "acknowledge",
                    "acknowledge_operations": [
                      {
                        "opmessage": {
                          "mediatypeid": "0",
                          "default_msg": "1"
                        },
                        "opmessage_usr": [
                          {
                            "userid": "1"
                          }
                        ],
                        "operationtype": "0"
                      }
                    ],
                    "def_longdata": "name:{EVENT.NAME}",
                    "recovery_operations": [
                      {
                        "opmessage": {
                          "mediatypeid": "0",
                          "default_msg": "1"
                        },
                        "opmessage_usr": [
                          {
                            "userid": "1"
                          }
                        ],
                        "operationtype": "0"
                      }
                    ],
                    "actionid": "15",
                    "ack_longdata": "name:{EVENT.NAME}",
                    "r_shortdata": "resolve",
                    "r_longdata": "name:{EVENT.NAME}"
                  },
                  "8b6e7b6ede4c99175650c8ef59060aa6"
                ]
              },
              {
                "file": "/usr/share/zabbix/api_jsonrpc.php",
                "line": 63,
                "function": "execute",
                "class": "CJsonRpc",
                "type": "->",
                "args": []
              }
            ]
          },
          "id": 1
        }
      

      Expected: Zabbix should catch incorrect parameters before this error.

      Attachments

        Activity

          People

            zabbix.dev Zabbix Development Team
            zux Edgars Melveris
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: