Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation handling for multiline encrypted values #49

Open
adamsilkcm opened this issue Apr 15, 2021 · 1 comment
Open

Indentation handling for multiline encrypted values #49

adamsilkcm opened this issue Apr 15, 2021 · 1 comment

Comments

@adamsilkcm
Copy link

Current behavior:

When attemptnig to decrypt a value that is indented, the indentation is considered part of the block to handle and gets re-encrypted.
E.g.

---
nested:
  with:
    indentation: !vault |
      $ANSIBLE_VAULT;1.1;AES256
      66393664653066663837336333626666653233353164343332386439353830356238346538383963
      6331613230303632616665306230333430393862323737623664

Highlighting the last three lines and the toggling encryption produces something like this:

---
nested:
  with:
    indentation: !vault |
$ANSIBLE_VAULT;1.1;AES256
30383735633861383762613236356435303863396531376331623335303263313636633638373436
39636438363531393562353530616264613331316139326232316230383530376639636136336537
35363833636339326366613632343263636264346235343838663434313535656234393865306335
3065316662666563353364333337386138660

Desired behavior

Detect ANSIBLE_VAULT string to determine encryption or decryption, then strip leading whitespace from lines before decrypting.
Above actions would produce something like:

---
nested:
  with:
    indentation: !vault |
cleartext

Workarounds:

Manually dedenting before toggling works, just adds an extra chord between me and the cleartext.

Other notes:

Vault does not produce leading whitespace in its output, so there is no risk of removing information when removing leading whitespace.
Vault errors with Non-hexadecimal digit found ERROR when attempting to decrypt items with spaces in them.
Auto-indenting upon encryption not desired.

@wilkis3
Copy link

wilkis3 commented May 14, 2021

Very nice written issue. I have the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants