-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keyfile cannot have a newline or other white space #37
Comments
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 LeastAuthority/python-challenge-bypass-ristretto#37. This eliminates white space including newlines around the key expected to be in that file.
Fixed by PrivateStorageio/ZKAPAuthorizer#198. |
I think any other users of python-challenge-bypass-ristretto still have the same problem so this should remain open. |
Thanks! The decision to export such a German API is valid, I guess, even if a bit more laissez faire would be nice of course. What kind of fix would you like to see? |
I'd be happy with either of the expected behaviors suggested in the issue description (maybe with a custom exception type instead of a lot of words for the exception case). |
I am setting up a tahoe-LAFS storage node, and ran into a problem where the key could not be decoded:
If the file holding the ristretto key ends with a newline, or a blank, or something not a NUL byte apparently, the decoding will fail with a pretty opaque
DecodeException()
without further info. This has cost me a couple of hours :( In the past I only had systems fail because files didn't end with a newline, so this is a fun and welcome change. Even better I would like more robust parsing.Or maybe just add this to the spec and make our users call
.strip()
on the strings they senddecode_base64()
's way?Steps to reproduce
Note the blank character at the end of the string.
Expected behaviour
Maybe just work:
Or maybe fail with a more specific error description:
Actual behavior
Workaround
Write your key file with
echo -n
or a proper editor that lets you not add a newline. (I had only nano on that system, not great.)The text was updated successfully, but these errors were encountered: