Commit 017566a2 by Abhijit Menon-Sen

Use AES256 if the cipher is not write-whitelisted

parent 47bcdf59
...@@ -132,11 +132,11 @@ class VaultLib: ...@@ -132,11 +132,11 @@ class VaultLib:
if self.is_encrypted(b_data): if self.is_encrypted(b_data):
raise AnsibleError("data is already encrypted") raise AnsibleError("data is already encrypted")
if not self.cipher_name: if not self.cipher_name or self.cipher_name not in CIPHER_WRITE_WHITELIST:
self.cipher_name = u"AES256" self.cipher_name = u"AES256"
cipher_class_name = u'Vault{0}'.format(self.cipher_name) cipher_class_name = u'Vault{0}'.format(self.cipher_name)
if cipher_class_name in globals() and self.cipher_name in CIPHER_WHITELIST: if cipher_class_name in globals():
Cipher = globals()[cipher_class_name] Cipher = globals()[cipher_class_name]
this_cipher = Cipher() this_cipher = Cipher()
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment