diff --git a/setup.cfg b/setup.cfg index 4530a53..5370b65 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = vaultpy -version = 0.0.3 +version = 0.0.4 author = Tim Loyer author_email = tloyer@apps.directemployers.org description = A module to parse injected Vault secrets and track their usage with Datadog. diff --git a/vault/__init__.py b/vault/__init__.py index c77f7d2..5174465 100644 --- a/vault/__init__.py +++ b/vault/__init__.py @@ -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 @@ -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)