Repository navigation
Replace deprecated crypt module and bump version to 2.1 - #48
Merged
Merged
Conversation
The crypt module is removed in Python 3.13. Verify the password by calling crypt(3) from libcrypt through ctypes instead, comparing in constant time and rejecting empty or locked hashes. Stop printing part of the stored hash to stdout. Replace the no-op package_dir with packages=[] in setup.py.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThe PR prepares the project for Python 3.13 by replacing the deprecated crypt module with libcrypt access via ctypes and safer password-hash handling, while updating packaging configuration and the release version to 2.1. Sequence diagram for ctypes-based password verificationsequenceDiagram
participant User
participant software_station
participant libcrypt
User->>software_station: enter password
software_station->>software_station: ctypes.CDLL
software_station->>libcrypt: crypt(password, stored_hash)
libcrypt-->>software_station: computed_hash
software_station->>software_station: hmac.compare_digest
alt empty or locked stored hash
software_station-->>User: reject password
else hashes differ
software_station-->>User: reject password
else hashes match
software_station-->>User: accept password
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. This changes password verification at an authentication boundary by replacing Python's crypt call with a direct libcrypt invocation and digest comparison. If the ctypes binding or hash handling is wrong, users could be denied access or an invalid password could be accepted; reverting restores the old check but cannot undo any access granted while the faulty verifier was live.
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.
The crypt module is removed in Python 3.13. Verify the password by calling crypt(3) from libcrypt through ctypes instead, comparing in constant time and rejecting empty or locked hashes. Stop printing part of the stored hash to stdout.
Replace the no-op package_dir with packages=[] in setup.py.
Summary by Sourcery
Maintain password authentication compatibility with modern Python while improving verification security and package configuration.
Bug Fixes:
Enhancements: