Skip to content

Commit

Permalink
Addresses ansible#6579 Disallow vault passwords with newline characte…
Browse files Browse the repository at this point in the history
…rs by stripping them in utils
  • Loading branch information
jctanner committed Mar 19, 2014
1 parent 5f42804 commit 8c2e1e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/ansible-vault
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def _read_password(filename):
f = open(filename, "rb")
data = f.read()
f.close
data = data.strip()
return data

def execute_create(args, options, parser):
Expand Down
4 changes: 4 additions & 0 deletions lib/ansible/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,10 @@ def ask_vault_passwords(ask_vault_pass=False, ask_new_vault_pass=False, confirm_
if new_vault_pass != new_vault_pass2:
raise errors.AnsibleError("Passwords do not match")

# enforce no newline chars at the end of passwords
vault_pass = vault_pass.strip()
new_vault_pass = new_vault_pass.strip()

return vault_pass, new_vault_pass

def ask_passwords(ask_pass=False, ask_sudo_pass=False, ask_su_pass=False, ask_vault_pass=False):
Expand Down

0 comments on commit 8c2e1e2

Please sign in to comment.