HTTP Basic Auth - sending username but no password triggers exception
- Dominant language
- Python
- Stars
- 434
- Forks
- 103
- PR merge metrics
- No merged PRs in 30d
Description
Reported on our repo here: https://github.com/Staffjoy/suite/issues/3
We send an API key as an HTTP basic username without a password, e.g. `curl --user API_KEY: http://app.local`. This appears to throw the following error on python 2.7 with unirest 1.1.7:
```
Traceback (most recent call last):
File "/opt/python/2.7.12/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/opt/python/2.7.12/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/travis/virtualenv/python2.7.12/lib/python2.7/site-packages/unirest/__init__.py", line 82, in __request
encoded_string = base64.b64encode(user + ':' + password)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The traceback points to unirest/__init__.py, in __request where HTTP Basic Auth is assembled; start there and reproduce the API-key-only request described in the issue. Done means a username with no password no longer raises the reported TypeError; add or run coverage for that request if the repository provides it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100