gh-73936: Add hashlib.saslprep (RFC 4013) and use it in smtplib for Unicode credentials#148692
Open
blink1073 wants to merge 3 commits intopython:mainfrom
Open
gh-73936: Add hashlib.saslprep (RFC 4013) and use it in smtplib for Unicode credentials#148692blink1073 wants to merge 3 commits intopython:mainfrom
blink1073 wants to merge 3 commits intopython:mainfrom
Conversation
…e credentials Co-authored-by: Arnt Gulbrandsen <arnt@gulbrandsen.priv.no> Co-authored-by: Bernie Hackett <bernie.hackett@gmail.com>
Author
|
Kicking to re-run the CLA bot |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a continuation of #103611, updated to address all open reviewer comments.
Changes
Lib/_saslprep.py(new): RFC 4013 SASLprep implementation, adapted fromthe PyMongo project with
permission. Apache 2.0 licence header retained; MongoDB corporate CLA is
signed.
Lib/hashlib.py: exposessaslprepashashlib.saslprep(public API),per the suggestion from @gpshead in the original review.
Lib/smtplib.py: applieshashlib.saslprep()inauth_plain(),auth_login(), andauth_cram_md5(); switchesauth()encoding from'ascii'to'utf-8'.Lib/test/test_saslprep.py(new): tests for RFC 4013 examples,character mapping, prohibited characters, bidirectional checks, unassigned
code points, and test cases from the MongoDB JS saslprep library.
Lib/test/test_smtplib.py: adds Unicode credentials to the simulatedserver (Devanagari username/password; a password that SASLprep normalises via
NFKC) and exercises all three auth mechanisms with them, including verifying
that SASLprep-equivalent passwords authenticate successfully.
Python/stdlib_module_names.h: registers_saslprep.Doc/library/hashlib.rst: new "String preparation" section documentinghashlib.saslprep().📚 Documentation preview 📚: https://cpython-previews--148692.org.readthedocs.build/