Skip to content

Commit

Permalink
Merge pull request #3 from DirectEmployers/fix-whitespace-and-b64-com…
Browse files Browse the repository at this point in the history
…parison

fix b64 comparison
  • Loading branch information
mklauber authored Mar 8, 2021
2 parents 26c19a7 + ea201e0 commit a1bae76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = vaultpy
version = 0.0.3
version = 0.0.4
author = Tim Loyer
author_email = [email protected]
description = A module to parse injected Vault secrets and track their usage with Datadog.
Expand Down
4 changes: 2 additions & 2 deletions vault/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def _is_base64(s):
Checks whether a sting has been base 64 encoded.
"""
try:
return b64encode(b64decode(s)) == s
return b64encode(b64decode(s)) == bytes(s, "utf-8")
except Exception:
return False

Expand All @@ -35,7 +35,7 @@ def _load_vault_secrets() -> Dict:
should not be called anywhere except within this module!
"""
with open(environ["VAULT_SECRETS_PATH"]) as file:
contents = file.read()
contents = file.read().strip()

if _is_base64(contents):
contents = b64decode(contents)
Expand Down

0 comments on commit a1bae76

Please sign in to comment.