Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* just dont pass locals - also fix globals - added tests * fixed tests (cherry picked from commit b9b0b23)
- Loading branch information
Showing
7 changed files
with
66 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- Handle improper variable substitution that was happening in safe_eval, it was always meant to just do 'type enforcement' and have Jinja2 deal with all variable interpolation. Also see CVE-2019-10156 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
- name: test tempating corner cases | ||
hosts: localhost | ||
gather_facts: false | ||
vars: | ||
empty_list: [] | ||
dont: I SHOULD NOT BE TEMPLATED | ||
other: I WORK | ||
tasks: | ||
- name: 'ensure we are not interpolating data from outside of j2 delmiters' | ||
assert: | ||
that: | ||
- '"I SHOULD NOT BE TEMPLATED" not in adjacent' | ||
- globals1 == "[[], globals()]" | ||
- globals2 == "[[], globals]" | ||
vars: | ||
adjacent: "{{ empty_list }} + [dont]" | ||
globals1: "[{{ empty_list }}, globals()]" | ||
globals2: "[{{ empty_list }}, globals]" | ||
|
||
- name: 'ensure we can add lists' | ||
assert: | ||
that: | ||
- (empty_list + [other]) == [other] | ||
- (empty_list + [other, other]) == [other, other] | ||
- (dont_exist|default([]) + [other]) == [other] | ||
- ([other] + [empty_list, other]) == [other, [], other] | ||
|
||
- name: 'ensure comments go away and we still dont interpolate in string' | ||
assert: | ||
that: | ||
- 'comm1 == " + [dont]"' | ||
- 'comm2 == " #} + [dont]"' | ||
vars: | ||
comm1: '{# {{nothing}} {# #} + [dont]' | ||
comm2: "{# {{nothing}} {# #} #} + [dont]" | ||
|
||
- name: test additions with facts, set them up | ||
set_fact: | ||
inames: [] | ||
iname: "{{ prefix ~ '-options' }}" | ||
iname_1: "{{ prefix ~ '-options-1' }}" | ||
vars: | ||
prefix: 'bo' | ||
|
||
- name: add the facts | ||
set_fact: | ||
inames: '{{ inames + [iname, iname_1] }}' | ||
|
||
- assert: | ||
that: | ||
- inames == ['bo-options', 'bo-options-1'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters