GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — bpo-29427: allow unpadded input and ouput in base64 module by guillp · Pull Request #7072 · python/cpython Conversation
|
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. When your account is ready, please add a comment in this pull request Thanks again to your contribution and we look forward to looking at it! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Good catch, this indeed breaks when the string to decode contains non-base64 characters, which would be ignored by binascii.a2b_decode(). If you agree, I'll push a fix including all that. BTW, I signed the CLA. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Fixes b64decode on non padded input if that input contains invalid characters. Implements validate=True for non padded input.
|
Any news? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@guillp there seem to be some whitespace issues (according to Travis). Could you fix those up? I'd love to have this feature! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It seems that documentation should be updated.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
What's the holdup? Can't the maintainer edit the PR if @guillp seems to have forgotten about it? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
updated commit description Co-Authored-By: Sergey Fedoseev <[email protected]>
Co-Authored-By: Sergey Fedoseev <[email protected]>
|
Very sorry about that. git push to github.com is not allowed from my workplace, so I add to commit manually from github.com UI which is a pain. Thanks to @sir-sigurd for the review. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I hope this is not dead, it would've been useful for me. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| if not padded: | ||
| if validate and not re.match(b'^[A-Za-z0-9+/]*$', s): | ||
| raise binascii.Error('Padding found in supposedly non-padded input') | ||
| s += b'==' |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why two ==s is always the right padding. I may be missing something.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Probably depends on the base64 flavor of what is accepted as "right" padding, but as far as I understand the a2b_base64 implementation extra padding characters are just ignored, so always appending == should be safe in this context.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks. Maybe worth putting that in a comment in the code.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I am using util from django.utils.http.urlsafe_base64_encode
https://docs.djangoproject.com/en/3.1/ref/utils/#django.utils.http.urlsafe_base64_encode
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| _urlsafe_decode_translation = bytes.maketrans(b'-_', b'+/') | ||
|
|
||
| def urlsafe_b64encode(s): | ||
| def urlsafe_b64encode(s, validate=False, padded=True): |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The validate arg isn't used. And if it's going to be added it should be added to urlsafe_b64decode instead.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is there anything that can be done to push this change forward? Should a new PR be submitted if the original contributor has lost interest? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.