slp_all: use triple-brace templating in templates - #11317
Conversation
This is a second pass at replacing double brace template marks with triple brace
marks. It addresses more complex uses that the sed rewrite did not find by using
PCRE via perl.
[git-generate]
for f in $(
(
for p in $(
yq 'select(.owner.github == "elastic/sec-linux-platform")|.name' packages/**/manifest.yml \
| grep -v -- '---'
); do
rg -l -g '*.yml' "[^{]\{\{[^{][ .a-zA-Z0-9_]*[^}]}}[^}]" packages/$p
done
)|grep "elasticsearch/ingest_pipeline"|sort|uniq
); do
perl -pi -e 's/(?<!\{)(\{\{[^{][ .a-zA-Z0-9_]*[^}]}})(?!\})/{$1}/g' $f
done
for p in $(git diff --name-only HEAD~1|cut -d/ -f1,2|sort|uniq); do
(
cd $p
elastic-package test pipeline -g
elastic-package changelog add \
--description "Use triple-brace Mustache templating when referencing variables in ingest pipelines." \
--type bugfix \
--next patch \
--link elastic#11317
)>/dev/null 2>&1
done
🚀 Benchmarks reportTo see the full report comment with |
|
💚 Build Succeeded
cc @efd6 |
|
Pinging @elastic/sec-linux-platform (Team:Security-Linux Platform) |
|
Package auditd - 3.20.2 containing this change is available at https://epr.elastic.co/search?package=auditd |
|
Package cloud_defend - 1.2.6 containing this change is available at https://epr.elastic.co/search?package=cloud_defend |
|
Package network_traffic - 1.31.2 containing this change is available at https://epr.elastic.co/search?package=network_traffic |
|
Package sysmon_linux - 1.7.1 containing this change is available at https://epr.elastic.co/search?package=sysmon_linux |
|
Package system_audit - 1.10.3 containing this change is available at https://epr.elastic.co/search?package=system_audit |
|
Package network_traffic - 1.32.1 containing this change is available at https://epr.elastic.co/search?package=network_traffic |
The mustache templating system used by ingest pipelines has two levels of escaping available, not escaped (triple stache) and HTML escaped (double stache) — see man mustache[1] under "tag types: variables". This can lead to data corruption, particularly in cases where an operating system has chosen to use a character requiring escaping in its path syntax. [1]http://mustache.github.io/mustache.5.html [git-generate] for f in $( ( for p in $( yq 'select(.owner.github == "elastic/sec-linux-platform")|.name' packages/**/manifest.yml \ | grep -v -- '---' ); do rg -l -g '*.yml' "[^{]\{\{[^{][ .a-zA-Z0-9_]*[^}]}}[^}]" packages/$p done )|grep "elasticsearch/ingest_pipeline"|sort|uniq ); do perl -pi -e 's/(?<!\{)(\{\{[^{][ .a-zA-Z0-9_]*[^}]}})(?!\})/{$1}/g' $f done for p in $(git diff --name-only HEAD~1|cut -d/ -f1,2|sort|uniq); do ( cd $p elastic-package test pipeline -g elastic-package changelog add \ --description "Use triple-brace Mustache templating when referencing variables in ingest pipelines." \ --type bugfix \ --next patch \ --link elastic#11317 )>/dev/null 2>&1 done
The mustache templating system used by ingest pipelines has two levels of escaping available, not escaped (triple stache) and HTML escaped (double stache) — see man mustache[1] under "tag types: variables". This can lead to data corruption, particularly in cases where an operating system has chosen to use a character requiring escaping in its path syntax. [1]http://mustache.github.io/mustache.5.html [git-generate] for f in $( ( for p in $( yq 'select(.owner.github == "elastic/sec-linux-platform")|.name' packages/**/manifest.yml \ | grep -v -- '---' ); do rg -l -g '*.yml' "[^{]\{\{[^{][ .a-zA-Z0-9_]*[^}]}}[^}]" packages/$p done )|grep "elasticsearch/ingest_pipeline"|sort|uniq ); do perl -pi -e 's/(?<!\{)(\{\{[^{][ .a-zA-Z0-9_]*[^}]}})(?!\})/{$1}/g' $f done for p in $(git diff --name-only HEAD~1|cut -d/ -f1,2|sort|uniq); do ( cd $p elastic-package test pipeline -g elastic-package changelog add \ --description "Use triple-brace Mustache templating when referencing variables in ingest pipelines." \ --type bugfix \ --next patch \ --link elastic#11317 )>/dev/null 2>&1 done


Proposed commit message
Checklist
changelog.ymlfile.Author's Checklist
How to test this PR locally
Related issues
Screenshots