-
Problem report
-
Resolution: Unresolved
-
Trivial
-
None
-
6.0.5rc1, 6.2.0beta1
Problem description: If user macros are used in webhook parameter name and webhook parameter value, then they are resolved when the webhook is triggered by an action, but are not resolved when webhook is trigerred in Test mode.
For webhook parameter value this is no big deal, as the user can input its value by hand, but the webhook parameter name is used with a non-resolved user macro, and this cannot be changed in webhook test mode.
Steps to reproduce:
- Create a host with an item and a trigger
- Create an Action that will send a notification when the created trigger goes in status problem.
- Create global user macro (for example: {$END}).
- Create webhook with Javascript = *Zabbix.Log(3, value); * and one of the parameters should use the created user macro both in its name and in its value (for example: name = URL {$END}, value = https://zabbix{$END}).
- Add all required message templates to this webhook.
- Add user media to Admin user that would use this webhook.
- Thigger the alarm in order for the webhook to get executed. Result - the macros are expanded both in the parameter name and value:
1383489:20220429:172038.191 {"URL .com":"https://zabbix.com","HTTPProxy":"","To":"[email protected]","Subject":"Resolved in 41m 13s: Trapper trigger","Message":"Problem has been resolved at 17:20:34 on 2022.04.29\r\nProblem name: Trapper trigger\r\nProblem duration: 41m 13s\r\nHost: test\r\nSeverity: Warning\r\nOriginal problem ID: 35\r\n"}
- Open the list of Media types and press "Test" link for this webhook.
- Note that in the opened overlay dialog the user macro is not resolved in parameter name and in parameter value.
- Press test button and check log.
Result: The user macro is not resolved in the record in the log file:
1383490:20220429:172342.511 {"HTTPProxy":"","Message":"{ALERT.MESSAGE}","Subject":"{ALERT.SUBJECT}","To":"{ALERT.SENDTO}","URL {$END}":"https:\/\/zabbix{$END}"}
Expected: Behavior in test mode should be the same as in actual webhook execution. From this point of view it looks like resolving user macros in webhook parameter names is a bad idea. I would suggest to restrict resolution of user macros in webhook parameter names.