-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace crypt module with passlib #2108
Replace crypt module with passlib #2108
Conversation
5cba20c
to
6869fb0
Compare
7573b31
to
226bde3
Compare
226bde3
to
64d4a86
Compare
I think reviewing by commit makes sense still, but we can probably just squash all three commits now once we're happy with the changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, please give it a VM test if you haven't yet.
Just tested this on an Oracular install and I was able to login as expected. Based on some out-of-band discussion, I'm going to keep all three commits for historical accuracy but I'll update the commit messages so they're a little more interesting. |
The `crypt` module was deprecated in python3.11 and officially removed in python3.13. This commit introduces equivalent functionality using the `passlib` module instead. The `passlib` module is listed directly in the python documentation as a replacement for the `crypt` module[0]. Additionally, this module is already provided by the `python3-passlib` package in main. The main functionality of `crypt_password` is not replaced in this commit. Instead, this commit acts more as a transient commit to demonstrate that, given the right parameters, we can use `passlib` to provide equivalent functionality compared with what we expected from the `crypt`-based implementation. [0] https://docs.python.org/3.12/library/crypt.html
Replace usage of the `crypt` module from the stdlib with `passlib`, which is provided by the python3-passlib (main) package. Follow-up to the previous commit which introduced the `passlib`-based functionality, and now switches `crypt_password` over to using it. The equivalence between the two implementations can be further demonstrated by the canary test passing with just the previous commit and also passing with this one.
64d4a86
to
f1e62f2
Compare
In python3.13, the crypt submodule will be removed from the standard library. This won't affect snap builds until core26, but makes dryrun testing difficult. This PR introduces some logic to shell out to perl to compute the hash in dry-run mode only.Replace
crypt
module usage with thepasslib
module, which is provided by thepython3-passlib
package. The package is already in Main and doesn't appear to have any open CVEs. This will fix the issue when trying to import thecrypt
module in python3.13 or later, where it was finally removed.