Description
SUMMARY
when providing a string parameter to an alias command (such as - blah {{string_value}}
),
when that input string contains an "=" character - the string value is cut incorrectly assuming the "=" to denote a key:value extra parameter - overriding the required parameter.
STACKSTORM VERSION
st2 3.2.0, on Python 2.7.5
OS, environment, install method
centOS 7 - installation on a single host as described at https://docs.stackstorm.com/install/rhel7.html
Steps to reproduce the problem
have a simple alias:
---
name: "test alias"
action_ref: "core.noop"
description: "test for data structs"
formats:
- bar {{ someval }}
ack:
enabled: false
result:
format: |
a parameter: {{execution.parameters.someval}}
Bug condition: invoke this alias via chat client with the command:
!bar https://www.foo.com/api/v1?some=url&with=eqchars
Expected Results
Chatbot should return
a parameter: https://www.foo.com/api/v1?some=url&with=eqchars
Actual Results
Chatbot returns:
Command "bar https://www.foo.com/?some=url&with=eqchars" doesn't match format string "bar {{ someval }}"
Extra Info
complex strings with spaces and special characters are handled just fine - except when containing an '='
this issue seems to come from st2/st2common/st2common/models/utils/action_alias_utils.py where extra parameters are parsed before anything else and then cut from the command relying on the condition that it contains a '=' without checking if all other required parameters have been parsed first, effectively cutting the last string parameter from the command and parsing it as extra key:value pair instead of what it's supposed to be.
so my theory - in the example failure - the resulting parameters parsed from the alias command will be :
{"parameters": {
"https://www.foo.com/?some": "url&with=eqchars" }
}
instead of:
{"parameters": {
"someval": "https://www.foo.com/?some=url&with=eqchars" }
}
Hope that helps...
Thanks!