Skip to content
This repository has been archived by the owner on Jun 9, 2022. It is now read-only.

Encoding problem for long random passwords #5

Open
Oneiroi opened this issue Oct 23, 2014 · 1 comment
Open

Encoding problem for long random passwords #5

Oneiroi opened this issue Oct 23, 2014 · 1 comment

Comments

@Oneiroi
Copy link

Oneiroi commented Oct 23, 2014

Url: http://demo.yubico.com/u2f?tab=register

 Traceback (most recent call last):
  File "/root/python-u2flib-server-demo/examples/yubiauth_server.py", line 118, in __call__
    password = request.params['password']
  File "/usr/lib/python2.7/dist-packages/webob/multidict.py", line 312, in __getitem__
    return self._decode_value(self.multi.__getitem__(self._encode_key(key)))
  File "/usr/lib/python2.7/dist-packages/webob/multidict.py", line 301, in _decode_value
    value = value.decode(self.encoding, self.errors)
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xbd in position 12: invalid start byte

Note this was rendered to screen; this occured using a 128char output for the password as follows.

pwgen -cnsy1 128

sG0hdZ5Op,L5%bDf@xh9Fp-lJd5-~!&D~X0C~h=];*.}0i5U7n2z#jj8?QncGr[qR@c%e<#GKb@YLK*34QQFN$4BfynM8:IU08Zt+M3M@ltDpUC-s4a~xvv#+^p!=+OC

>>> passwd = """sG0hdZ5Op,L5%bDf@xh9Fp-lJd5-~!&D~X0C~h=];*.}0i5U7n2z#jj8?QncGr[qR@c%e<#GKb@YLK*34QQFN$4BfynM8:IU08Zt+M3M@ltDpUC-s4a~xvv#+^p!=+OC"""
>>> passwd[12]
'%'

Seems there's some issue encoding issue around the % char once passed to the backend.

@josh4057
Copy link

You've probably already resolved or worked around this issue, but I found Python 2.7 documentation that might help: 5.6.2. String Formatting Operations might be useful since "passwd" looks like it's using the Codec objects .encode/.decode, from 7.8.1.1. Codec Objects, to return a plain string which has one built-in unique operator "%".

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants