From 6e072fb1269ee0159ccf52e3eb85323804bdf460 Mon Sep 17 00:00:00 2001 From: Tim Loyer Date: Mon, 8 Mar 2021 10:30:37 -0500 Subject: [PATCH 1/2] fix b64 comparison --- vault/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) From ea201e08df2300b49964d1059dca9d6b09475a57 Mon Sep 17 00:00:00 2001 From: Tim Loyer Date: Mon, 8 Mar 2021 10:35:07 -0500 Subject: [PATCH 2/2] bump version --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.