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

sdd_all: use triple-brace templating #11286

Merged
merged 1 commit into from
Oct 2, 2024
Merged

sdd_all: use triple-brace templating #11286

merged 1 commit into from
Oct 2, 2024

Commits on Oct 1, 2024

  1. sdd_all: use triple-brace templating

    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-deployment-and-devices")|.name' packages/**/manifest.yml \
    			| grep -v -- '---'
    		); do
    			rg -l -g '*.yml' ": ('\{\{[^{][ .a-zA-Z0-9_]*[^}]}}'|\"\{\{[^{][ .a-zA-Z0-9_]*[^}]}}\")" packages/$p
    		done
    	)|grep "elasticsearch/ingest_pipeline"|sort|uniq
    ); do
    	sed -i -r "s/: (['\"])\{\{([^{][ .a-zA-Z0-9_]*[^}])}}['\"]/: \1{{{\2}}}\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#11286
    	)>/dev/null 2>&1
    done
    efd6 committed Oct 1, 2024
    Configuration menu
    Copy the full SHA
    58de75f View commit details
    Browse the repository at this point in the history