summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/cli
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2019-10-11 16:17:10 +0200
committerGitHub <noreply@github.com>2019-10-11 16:17:10 +0200
commit7f4befdea77045fa83b5f2b304bd5e16b219f74c (patch)
treea6d23e2f80dc207731d07e4dcfdba89dd5b72859 /test/integration/targets/cli
parentprepare_vmware_tests: use module_defaults (#63209) (diff)
downloadansible-7f4befdea77045fa83b5f2b304bd5e16b219f74c.tar.xz
ansible-7f4befdea77045fa83b5f2b304bd5e16b219f74c.zip
Wrap CLI Passwords with AnsibleUnsafeText, ensure unsafe context is not lost during encode/decode (#63351)
* Wrap .encode and .decode on AnsibleUnsafe objects * runme.sh needs to be executable * ci_complete * Update changelog with CVE
Diffstat (limited to 'test/integration/targets/cli')
-rw-r--r--test/integration/targets/cli/aliases2
-rwxr-xr-xtest/integration/targets/cli/runme.sh7
-rw-r--r--test/integration/targets/cli/setup.yml4
-rw-r--r--test/integration/targets/cli/test-cli.py21
4 files changed, 34 insertions, 0 deletions
diff --git a/test/integration/targets/cli/aliases b/test/integration/targets/cli/aliases
new file mode 100644
index 0000000000..6b71e884a1
--- /dev/null
+++ b/test/integration/targets/cli/aliases
@@ -0,0 +1,2 @@
+needs/target/setup_pexpect
+shippable/posix/group3
diff --git a/test/integration/targets/cli/runme.sh b/test/integration/targets/cli/runme.sh
new file mode 100755
index 0000000000..d9e846256f
--- /dev/null
+++ b/test/integration/targets/cli/runme.sh
@@ -0,0 +1,7 @@
+#!/usr/bin/env bash
+
+set -eux
+
+ANSIBLE_ROLES_PATH=../ ansible-playbook setup.yml
+
+python test-cli.py
diff --git a/test/integration/targets/cli/setup.yml b/test/integration/targets/cli/setup.yml
new file mode 100644
index 0000000000..9f6ab11741
--- /dev/null
+++ b/test/integration/targets/cli/setup.yml
@@ -0,0 +1,4 @@
+- hosts: localhost
+ gather_facts: no
+ roles:
+ - setup_pexpect
diff --git a/test/integration/targets/cli/test-cli.py b/test/integration/targets/cli/test-cli.py
new file mode 100644
index 0000000000..9893d6652e
--- /dev/null
+++ b/test/integration/targets/cli/test-cli.py
@@ -0,0 +1,21 @@
+#!/usr/bin/env python
+# Copyright (c) 2019 Matt Martz <matt@sivel.net>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import os
+
+import pexpect
+
+os.environ['ANSIBLE_NOCOLOR'] = '1'
+out = pexpect.run(
+ 'ansible localhost -m debug -a msg="{{ ansible_password }}" -k',
+ events={
+ 'SSH password:': '{{ 1 + 2 }}\n'
+ }
+)
+
+assert b'{{ 1 + 2 }}' in out