tomoh1r / ansible-vault

This project aim to R/W an ansible-vault yaml file
GNU General Public License v3.0
54 stars 32 forks source link

When decrypting with ansible-vault I get three dots (...) at the end of my secret. #52

Closed hmmlopez closed 2 years ago

hmmlopez commented 2 years ago

When I encrypt a string with this module and try to decrypt it again with ansible-vault I get (...) three dots at the end of my secret value.

vault = Vault("pass123")
with open("test.yaml", "w") as f:
    f.write(vault.dump("super_secret_password"))

And then I try to decrypt it with ansible-vault: ansible-vault decrypt test.yaml

I get the following output:

super_secret_password
...

or super_secret_password\n...\n to be more precise.

I was expecting just super_secret_password to be returned.

I'm using:

ansible-vault [core 2.13.6]
  config file = None
  python version = 3.9.15 (main, Oct 12 2022, 19:14:37) [GCC 11.2.0]
  jinja version = 3.1.2
  libyaml = True

and python:

ansible==6.6.0
ansible-core==2.13.6
ansible-vault==2.1.0

Is there something I'm missing, maybe a setting in this module to disable this (...) explicit end funtionality.

hmmlopez commented 2 years ago

Never mind, found the solution after looking into the Vault code, I should have used vault.dump_raw() method.