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

User macros wrongly escaped in script item parameters

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Duplicate
    • Icon: Trivial Trivial
    • None
    • 7.0.7
    • Server (S)
    • None
    • Zabbix 7.0.7 on RHEL8

      Description:

      Script item parameters are wrongly escaped if set via user macro.

      Steps to reproduce:

      Create host and script item with parameter "urls" with value '["https://www.srv1.com","https://www.srv2.com"]'. The javascript vill be simply:

      return value;

      This approach returs in item latest data correct expected value:

      {"urls":"[\"https://www.srv1.com\",\"https://www.srv2.com\"]"}

       

      Now define on the host user macro {$URLS} with the same parameter value and use this macro for item parameter value.

      Now the item last value will be:

      {"urls":"[\\\"https://www.srv1.com\\\",\\\"https://www.srv2.com\\\"]"}

      There are added additional backslashes for each doublequote in parameter value.

      Expected:
      The value returned for the script item will be correctly escaped if user macro is used for item parameter.

      Maybe this problem have something in common with existimg issue ZBX-24970

        1. image-2025-01-08-10-19-05-568.png
          111 kB
          Karel Bělunek
        2. image-2025-01-08-10-20-27-262.png
          110 kB
          Karel Bělunek

            askolmeisters Armands Arseniuss Skolmeisters
            kbelunek Karel Bělunek
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - Not Specified
                Not Specified
                Logged:
                Time Spent - 2.25h
                2.25h