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

[8.x] [Fleet] add escapeMultilineString Handlebar helper (#195159) #195497

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

opauloh
Copy link
Contributor

@opauloh opauloh commented Oct 8, 2024

Backport

This will backport the following commits from main to 8.x:

Questions ?

Please refer to the Backport tool documentation

## Summary

Adding a handlebar helper to escape multiline strings. It has the same
function as `escapeStringHelper`, but does not wrap strings in single
quotes, allowing concatenation of escaped variables in the `hbs`
template such as this example:

```hbs
audit_rules: "{{escape_multiline_string audit_rules}}
  {{escape_multiline_string "
  # Session data audit rules
  -a always,exit -F arch=b64 -S execve,execveat -k exec
  -a always,exit -F arch=b64 -S exit_group
  -a always,exit -F arch=b64 -S setsid"}}"
{{else}}
  {{#if audit_rules}}
audit_rules: {{escape_string audit_rules}}
  {{/if}}
{{/if}}
```

The above would not be possible using only `escape_string` as
`audit_rules` would be wrapped in single quotes.

## Screenshots

The example above illustrates how this option allows the Auditd manager
integration to append Session data audit rules to the `audit_rules`
field when Session data is enabled in the integration
([PR](elastic/integrations#11336)).

<img width="872" alt="image"
src="https://github.com/user-attachments/assets/325d784d-26a4-4dfe-9d0e-54d51c3ed060">

<img width="801" alt="image"
src="https://github.com/user-attachments/assets/ebd521c0-4471-48f9-ba8d-94630ea0efd2">

(cherry picked from commit 407137a)
@opauloh opauloh enabled auto-merge (squash) October 8, 2024 19:42
@botelastic botelastic bot added the Team:Fleet Team label for Observability Data Collection Fleet team label Oct 8, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@opauloh opauloh requested review from kibanamachine and a team and removed request for kibanamachine October 8, 2024 19:56
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

@opauloh opauloh merged commit 7b6a3d2 into elastic:8.x Oct 9, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Fleet Team label for Observability Data Collection Fleet team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants