-
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
[Fleet] Only escape single '*' characters in YAML strings. #93257
[Fleet] Only escape single '*' characters in YAML strings. #93257
Conversation
Pinging @elastic/fleet (Team:Fleet) |
@mtojek @ycombinator if you have opinions about this I'd love to hear them. |
@skh it is still going to escape something like |
The initial issue was Do we have I believe now |
This will be coming from a text variable populated by the user, so I guess we should not treat as an alias. |
Do you have an issue for that, or can you describe in more detail what breaks in this case? I am only aware of #91401 which was a default variable in a package file. Please also have a look at how the |
@nchaulet I have tested this with this branch. If a user wants to enter a string starting with a Let me summarize. The issue is how to treat strings starting with The current behavior after the changes in this PR is:
For this PR I would suggest:
In addition I would suggest opening separate issues for:
|
e5c9fed
to
c15b582
Compare
Thanks for the detailed explanation! I see how template variables expanding to unexpected chars could lead to issues. I'm wondering if in the given Would this work? Switching from:
to:
|
@exekias Thank you, this indeed works.
|
++ on the simplest solution for now and "enforcing" it on the package side. I don't see any reasons at the moment we should add support for yaml aliases / references, I think it would only complicate things. |
Keep in mind that such change modifies the standard behavior of Kibana, which may mean that we'll have to adjust all templates for all packages. It's also not backwards compatible, so we'd have to add a constraint for specific Kibana version. |
+1 on this, this really overcomplicate things, if we want to support aliases and references I think it should be handled by the tooling, where you can control the "include" path or reference. In an integration managed by fleet we should try to be flat. Looking at what @exekias propose I think this is indeed the simplest solution and I think this an acceptable way of handling. |
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @skh |
Closed in favor of #93585 |
Summary
Fixes a problem with the
kafka
integration described in #93253(Thanks @mtojek for the analysis!)
This revisits the changes made in #91418 , which lead to the bug above.
Now the behavior is changed so that only the exact string "*" will be forced to be quoted, and everything else left as it was before.
The test cases verify the new behavior:
asterisk: { value: '*', type: 'string' }
is quoted so that it does not cause a YAML parser error (this is a fix for [Fleet] Adding integration: List of strings does not allow value['*']
#91401 which was what [Fleet] Escape YAML string values if necessary #91418 attempted)a: { value: '/opt/foo/*', type: 'string' }
andb: { value: '/something/else.log*', type: 'string' }
stay unquoted so they can be concatenated into/opt/foo/*/something/else.log*
(which is what the Kafka package does).How to test this
In the Fleet UI, verify that you can add both the
apm
and thekafka
packages to a policy. For APM, be sure to enable RUM.Then verify that you find the following snippets in the policy, and that the wildcards in the policy are correct. For Kafka:
For APM: