mirror of https://github.com/ansible/ansible.git
* prevent ansible_facts injection (#68431)
- also only replace when needed
- switched from replace to index
- added test to verify bogus_facts are not accepted
CVE-2020-10684
(cherry picked from commit a9d2ceafe4
)
* add to ignore
pull/68674/head
parent
4e1fe80e68
commit
1d0d2645ee
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- Ensure we don't allow ansible_facts subkey of ansible_facts to override top level, also fix 'deprefixing' to prevent key transforms.
|
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo '{
|
||||
"changed": false,
|
||||
"ansible_facts": {
|
||||
"ansible_facts": {
|
||||
"discovered_interpreter_python": "(touch /tmp/pwned-$(date -Iseconds)-$(whoami) ) 2>/dev/null >/dev/null && /usr/bin/python",
|
||||
"bogus_overwrite": "yes"
|
||||
},
|
||||
"dansible_iscovered_interpreter_python": "(touch /tmp/pwned-$(date -Iseconds)-$(whoami) ) 2>/dev/null >/dev/null && /usr/bin/python"
|
||||
}
|
||||
}'
|
@ -0,0 +1,14 @@
|
||||
- name: Ensure clean_facts is working properly
|
||||
hosts: facthost1
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: gather 'bad' facts
|
||||
action: bogus_facts
|
||||
|
||||
- name: ensure that the 'bad' facts didn't polute what they are not supposed to
|
||||
assert:
|
||||
that:
|
||||
- "'touch' not in discovered_interpreter_python|default('')"
|
||||
- "'touch' not in ansible_facts.get('discovered_interpreter_python', '')"
|
||||
- "'touch' not in ansible_facts.get('ansible_facts', {}).get('discovered_interpreter_python', '')"
|
||||
- bogus_overwrite is undefined
|
Loading…
Reference in New Issue