From b8b690a86543201529eb9439d2beb91f0c7a84de Mon Sep 17 00:00:00 2001 From: Florian Sesser <florian@privatestorage.io> Date: Thu, 6 May 2021 20:59:06 +0200 Subject: [PATCH] Eliminate white space around ristretto key when reading key file It is easy to erroneously add extra white space to a text file. For example when writing with an editor like `nano` or when using `echo` without the `-n` argument. Handing that white space over to python-challenge-bypass-ristretto's `decode_base64()` method will make it fail in a rather opaque way, see https://github.com/LeastAuthority/python-challenge-bypass-ristretto/issues/37. This eliminates white space including newlines around the key expected to be in that file. --- src/_zkapauthorizer/_plugin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_zkapauthorizer/_plugin.py b/src/_zkapauthorizer/_plugin.py index 1ce34fe..e63b05a 100644 --- a/src/_zkapauthorizer/_plugin.py +++ b/src/_zkapauthorizer/_plugin.py @@ -145,7 +145,7 @@ class ZKAPAuthorizer(object): signing_key = SigningKey.decode_base64( FilePath( kwargs.pop(u"ristretto-signing-key-path"), - ).getContent(), + ).getContent().strip(), ) announcement = { u"ristretto-issuer-root-url": root_url, -- GitLab