Skip to content
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] Invalid agent YAML is generated when quoted text fields are numeric #112896

Closed
adriansr opened this issue Sep 22, 2021 · 6 comments · Fixed by #114123
Closed

[Fleet] Invalid agent YAML is generated when quoted text fields are numeric #112896

adriansr opened this issue Sep 22, 2021 · 6 comments · Fixed by #114123
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team

Comments

@adriansr
Copy link

adriansr commented Sep 22, 2021

Kibana version: 7.13+ / 8.0

Describe the bug:

Saving a policy fails due to YAML error when a policy variable of type text has a numeric value and it's used inside a quoted string in the package's yml.hbs template.

Steps to reproduce:

  • Package defines a configuration variable, my_var of type text.
  • Agent hbs template uses this variable between quotes:
value: "{{my_var}}"

-or-

host: "{{my_var}}:8080"
  • Configure the package with a numeric value, 1234 or 0xABC.
  • Saving the policy results in an error (actual error msg may depend on context):

    Error

    can not read a block mapping entry; a multiline key may not be an implicit key

Expected behavior:

No error.

Examples:

This bug is exhibited by the Zoom package (latest version 0.6.0, 0.3.1 in cloud) when setting the Zoom verification token (secret_value variable):

Screen Shot 2021-09-22 at 23 20 03

Also the Bluecoat Director package and many others that build a "host:port" string from two separate variables:

Screen Shot 2021-09-22 at 23 14 36

@adriansr adriansr added bug Fixes for quality problems that affect the customer experience Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team labels Sep 22, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Feature:Fleet)

@adriansr
Copy link
Author

I think this may be introduced by #90371 which fixed #89955. Not sure if it'll be possible to fix this or we need to be more careful when quoting variables in packages to avoid this problem.

/cc @jen-huang

@jen-huang
Copy link
Contributor

Thanks for the thorough report @adriansr, I recall we had a few issues similar to this in the past. We'll take a look!

@nchaulet
Copy link
Member

nchaulet commented Oct 5, 2021

I think I could have solution that will work but it will require to make a change to the integrations that are expecting a string value

You can use !!str in a yaml file to force the yaml parser to get the value as a string

So if integration template look like this my_value: !!str {{test}} we could ensure the value will be a string without adding the extra quote.

Example:
Screen Shot 2021-10-05 at 3 23 49 PM

For this to work we will have to update integrations expecting a string osquery? and revert #90371

@elastic/integrations @aleksmaus what do you think of this solution?

@nchaulet nchaulet self-assigned this Oct 5, 2021
@aleksmaus
Copy link
Contributor

@nchaulet we changed osquery configuration in particular for the next 7.16 release (6.x version of osquery_manager integration), not using streams and the hbs template for them anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Fleet Fleet team's agent central management project Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants