-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Actions] Ability to declare unescaped messageVariables #83780
Comments
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
I'm just starting to look at another "escaping" issue, which I think will change things a bit as to how much escaping really needs to happen. Issue #79371 I'll have to dig into this issue a bit more, hopefully whatever we do in the 79731 issue will be appropriate for this issue as well. |
I'm a little confused by this: return [
{ name: 'state.signals_count', description: 'state.signals_count' },
{ name: '{context.results_link}', description: 'context.results_link' },
{ name: '{context.rule_id}', description: 'context.rule_id' },
]; At first I thought perhaps Per previously-referenced issue #79371, I'm hoping we can basically be in a position where you can always just use |
I have a draft PR of a change to the way mustache variables are escaped, here: #83919 It seems like the right thing to do, to fix the issue it's trying to fix, not sure it will help in this case though. The new escaping is really just for webhook json, slack and email message bodies - I think for the other actions, no escaping is needed at all, and that's the new default. So the question is, would the new escaping for the three actions ^^^ end up mangling a URL. All the new escaping, per format-type (basically action), is here: https://github.com/elastic/kibana/blob/4588f996764c607f2b685ebb1c7a6d246cb1f892/x-pack/plugins/actions/server/lib/mustache_renderer.ts Both the markdown and slack escaping will do escaping on Which means we need another mechanism. @cnasikas's suggestion of adding this in the action variable definition seems to make sense to me. I guess the new flag would be an indicator of whether the variables list would paste in |
@pmuellr how about |
I kinda think it should reflect what we're actually going to do here - use triple braces instead of double braces - to make it super-clear. Also keep in mind, this is something only alert developers need to deal with, in terms of sprinkling it over their context variable definitions - not something users would ever see. |
How about |
|
PR #83139 introduced a new way of declaring
messageVariables
. The type ofmessageVariables
changed fromActionVariable[]
toActionsVariables
.Security solution was providing the parameters as:
With the new formating, it passes them as:
Now, the
context.
,state.
, andparams.
are being prefixed automatically by theActionTypeForm
component. So{ name: 'rule_id', description: 'context.rule_id' }
will become{ name: 'context.rule_id', description: 'context.rule_id' }
. Because the logic of prefixing was moved inside the component we had to remove the prefixes ourselves. This created a problem with unescaped variables. Before{context.results_link}
was transformed to{{{context.results_link}}}
(unescaped version). Now if we do{results_link}
it will be transformed to{{context.{result_link}}}
.This will create a problem with URLs as they will be malformed.
We would like to have a way to declare which variables should be surrounded with
{{{}}}
(unescaped) and which not. MaybeActionVariable
could change to:Thank you a lot!
The text was updated successfully, but these errors were encountered: