1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/integration
Adrian Likins 9c58827410
Better handling of malformed vault data envelope (#32515)
* Better handling of malformed vault data envelope

If an embedded vaulted variable ('!vault' in yaml)
had an invalid format, it would eventually cause
an error for seemingly unrelated reasons.
"Invalid" meaning not valid hexlify (extra chars,
non-hex chars, etc).

For ex, if a host_vars file had invalid vault format
variables, on py2, it would cause an error like:

  'ansible.vars.hostvars.HostVars object' has no
  attribute u'broken.example.com'

Depending on where the invalid vault is, it could
also cause "VARIABLE IS NOT DEFINED!". The behavior
can also change if ansible-playbook is py2 or py3.

Root cause is errors from binascii.unhexlify() not
being handled consistently.

Fix is to add a AnsibleVaultFormatError exception and
raise it on any unhexlify() errors and to handle it
properly elsewhere.

Add a _unhexlify() that try/excepts around a binascii.unhexlify()
and raises an AnsibleVaultFormatError on invalid vault data.
This is so the same exception type is always raised for this
case. Previous it was different between py2 and py3.

binascii.unhexlify() raises a binascii.Error if the hexlified
blobs in a vault data blob are invalid.

On py2, binascii.Error is a subclass of Exception.
On py3, binascii.Error is a subclass of TypeError

When decrypting content of vault encrypted variables,
if a binascii.Error is raised it propagates up to
playbook.base.Base.post_validate(). post_validate()
handles exceptions for TypeErrors but not for
base Exception subclasses (like py2 binascii.Error).

* Add a display.warning on vault format errors
* Unit tests for _unhexlify, parse_vaulttext*
* Add intg test cases for invalid vault formats

Fixes #28038
2017-11-10 14:24:56 -05:00
..
targets Better handling of malformed vault data envelope (#32515) 2017-11-10 14:24:56 -05:00
asa.yaml Fix trailing space in ec2_vol example, fix 'the the' typos (#28440) 2017-08-19 23:00:51 +02:00
cloud-config-aws.yml.template Add region to ansible-test AWS cloud config. (#30733) 2017-09-22 00:19:21 -07:00
cloud-config-azure.yml.template Fix Azure config template. 2017-08-16 12:17:38 -07:00
cloud-config-cs.ini.template Add support for cloud tests to ansible-test. (#24315) 2017-05-05 16:23:00 +08:00
dellos6.yaml Migrate Network Tests into ansible/ansible (#18233) 2016-10-28 19:50:29 +01:00
dellos9.yaml Migrate Network Tests into ansible/ansible (#18233) 2016-10-28 19:50:29 +01:00
dellos10.yaml Migrate Network Tests into ansible/ansible (#18233) 2016-10-28 19:50:29 +01:00
eos.yaml eos_static_route DI module (#32587) 2017-11-07 11:13:03 +00:00
integration.cfg Fix ansible-test config management. 2017-10-04 12:52:36 -07:00
integration_config.yml Fix cosmetic problems in YAML source 2016-11-11 14:50:57 -08:00
inventory Fix fact failures cause by ordering of collectors (#30777) 2017-09-28 10:36:22 -04:00
inventory.network Add VyOS integration tests for net_linkagg (#26478) 2017-07-06 11:25:15 +02:00
inventory.networking.template Increase python version coverage for tests. (#24762) 2017-05-19 01:37:53 +08:00
inventory.remote.template Add support for OS X CI on Shippable. (#17160) 2016-08-23 10:49:46 -07:00
inventory.winrm.template Increase python version coverage for tests. (#24762) 2017-05-19 01:37:53 +08:00
ios.yaml IOS Ping: Add new module to support ping tests from IOS devices (#28557) 2017-08-29 11:21:49 -04:00
iosxr.yaml Fix trailing space in ec2_vol example, fix 'the the' typos (#28440) 2017-08-19 23:00:51 +02:00
junos.yaml Fix trailing space in ec2_vol example, fix 'the the' typos (#28440) 2017-08-19 23:00:51 +02:00
network-all.yaml New module: management of the Nuage Networks VSP SDN solution (network/nuage/nuage_vspk) (#24895) 2017-07-25 12:35:03 +01:00
network-integration.cfg Increase socket connect retry timeout for integration test (#30681) 2017-09-21 15:02:19 +05:30
nxos.yaml Integration Tests only: add static route, snmp_user, snapshot and hsrp it cases (#28933) 2017-10-26 11:27:55 -04:00
ops.yaml Fix trailing space in ec2_vol example, fix 'the the' typos (#28440) 2017-08-19 23:00:51 +02:00
platform_agnostic.yaml remove net_command (#28525) 2017-08-23 02:07:39 +05:30
target-prefixes.network openvswitch targets via network-integration (#27295) 2017-07-27 14:14:13 +01:00
vyos.yaml Add vyos_vlan DI module (#32072) 2017-10-27 15:21:37 +05:30
windows-integration.cfg Fix ansible-test config management. 2017-10-04 12:52:36 -07:00