ExportXMLWordPrintable

    • Type: Problem report
    • Resolution: Unresolved
    • Priority: Major
    • None
    • Affects Version/s: 7.0.29, 7.4.12, 8.0.0rc1 (master)
    • Component/s: Server (S)
    • None
    • Support backlog
    • 1

      Problem

      Zabbix expands Script and Webhook parameters, creates JSON, and stores it in alerts.parameters.

      The alerts.parameters field uses t_text storage. If the JSON is too large, the database code shortens it without keeping a valid JSON structure. Script and Webhook alerts may then fail. Email may still work because it uses the plain message from a separate field.

      Steps to reproduce

      1. Configure a Script argument or Webhook parameter with this macro:
        {ALERT.MESSAGE}
        
      2. Make the expanded message large enough that the full JSON in alerts.parameters exceeds 65,535 characters, or 65,535 bytes on MySQL.
      3. Trigger the action.
      4. Check the event Action log and the server log.

      Actual result

      Zabbix creates valid JSON and then shortens it at the field limit.

      Script may fail before the external script starts:

      Cannot parse parameters: cannot parse as a valid JSON object: unexpected end of string data
      

      Webhook may also fail because its JavaScript code receives the same invalid parameters. Email may still send the shortened plain message.

      Expected result

      Zabbix must not store invalid JSON that it created.

      If the parameters are too large, Zabbix should either store the complete valid value or reject the alert before it is stored. The Action log and server log should show a clear size limit error.

      Technical notes

      • create/src/schema.tmpl defines alerts.message and alerts.parameters as t_text.
      • src/zabbix_server/escalator/escalator.c creates the JSON and adds it to the alert row.
      • src/libs/zbxdb/dbinsert.c and src/libs/zbxdb/dbmisc.c limit text by field size without checking the JSON structure.
      • src/libs/zbxalerter/alert_manager.c parses Script parameters as JSON, sends Webhook parameters to the alerter, and uses the plain message for email.

      The same code path is present in 7.4.12 and in the checked release/7.0, release/7.4, and master source lines.

      Related issues

      • ZBX-20420 changed alerts.parameters from t_shorttext to t_text for the old limit of 2,048 characters on Oracle.
      • ZBX-20463 reported invalid Webhook JSON at offset 2049 and was closed as a duplicate of ZBX-20420.

      Those issues cover the old Oracle limit. This report covers the same failure at the current t_text limit.

      Acceptance criteria

      1. Zabbix never stores invalid JSON that it created in alerts.parameters.
      2. Tests cover Script and Webhook values below, at, and above the limit, including JSON escaping and UTF 8 values that use more than one byte.
      3. If Zabbix rejects an alert, the Action log and server log show a clear error.

            Assignee:
            Zabbix Development Team
            Reporter:
            Piotr Zakrzewski
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: