Conversation
tests/test_helpers.py
Outdated
| def test_basic_auth_decode(): | ||
| auth = helpers.BasicAuth.decode('Basic bmtpbTpwd2Q=') | ||
| @pytest.mark.parametrize('header', ( | ||
| 'Basic bmtpbTpwd2Q=', 'basic bmtpbTpwd2Q=')) |
There was a problem hiding this comment.
Nitpick: if placed one under the other, sequence items are better readable.
| ).decode(encoding).partition(':') | ||
| decoded = base64.b64decode( | ||
| encoded_credentials.encode('ascii'), validate=True | ||
| ).decode(encoding) |
There was a problem hiding this comment.
Not sure whether it's applicable to current PR, but JFYI some browsers (Firefox) don't encode some of UTF-8 bytes correctly, assuming ISO-8859-1 for unicode input and loosely encodes that input, which cuts some bytes in two-byte encoded chars (try entering €öäü in browser and see what you receive in server), which results in error during encoding since it cannot understand byte sequence when reaches those characters. Ref cherrypy/cherrypy#1680
There was a problem hiding this comment.
Thanks for the reminder.
We discussed it 2 or 3 years ago and decided to do nothing until users report.
There is no blame yet :)
There was a problem hiding this comment.
thanks @webknjaz. noted, but it seems to be out of scope of this PR though.
Codecov Report
@@ Coverage Diff @@
## master #3239 +/- ##
==========================================
- Coverage 98.09% 98.05% -0.04%
==========================================
Files 43 43
Lines 7856 7871 +15
Branches 1353 1354 +1
==========================================
+ Hits 7706 7718 +12
- Misses 58 60 +2
- Partials 92 93 +1
Continue to review full report at Codecov.
|
| omit = site-packages | ||
|
|
||
| [mypy] | ||
| incremental = false |
|
Thanks! |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs. |
What do these changes do?
These changes prevent passing illegal chars in the base64 payload.
It was possible to use
Authorization: Basic ???to getBasicAuth(login='', password='')without exceptions.Also, the related RFC https://www.ietf.org/rfc/rfc2617.txt allows the username and password to be blank, but the colon must be present.
and
Are there changes in behavior for the user?
Related issue number
Checklist
CONTRIBUTORS.txtCHANGESfolder<issue_id>.<type>for example (588.bugfix)issue_idchange it to the pr id after creating the pr.feature: Signifying a new feature..bugfix: Signifying a bug fix..doc: Signifying a documentation improvement..removal: Signifying a deprecation or removal of public API..misc: A ticket has been closed, but it is not of interest to users.