Repository navigation
Remove use of crypt, removed module in py3.13 - #67789
Merged
Merged
Conversation
Contributor
|
Requirements probably need to be built for this in order for passlib to actually be propagated to the static requirements files. |
3 tasks
Contributor
|
Rebase, resolve conflicts, run pre-commit so the static requirements files are updated. |
Contributor
Author
|
Ran |
twangboy
previously approved these changes
Apr 27, 2026
Contributor
|
Could we get a changelog please? |
Contributor
Author
done |
The crypt module was deprecated in Python 3.11 and removed in 3.13. salt/utils/pycrypto.py had a try/except ImportError on `import crypt` that masked the actual failure mode: on 3.11+ the import would resolve to `salt.utils.crypt` (a Salt internal helper), making HAS_CRYPT spuriously True, then crashing at module load with `AttributeError: module 'crypt' has no attribute 'methods'`. Drop the crypt-based code path entirely and rely on passlib for hashing. Add `passlib` to runtime requirements. Update callers in tests that referenced the removed `methods` and `HAS_CRYPT` symbols. Skip the nxos check_password test that depended on crypt-style (no-rounds) hashes; passlib's sha256_crypt always emits a `rounds=` prefix that nxos.check_password's existing regex cannot parse — that's a separate bug. Fixes saltstack#67118
- test_pycrypto_no_crypt_import: verifies HAS_CRYPT and module-level methods dict are gone (would fail on master where crypt.methods is referenced at import time) - test_gen_hash_passlib: parametrized test covering sha512/sha256/md5/crypt via passlib (the only remaining backend after crypt removal) - test_gen_hash_no_lib: verifies SaltInvocationError when HAS_PASSLIB=False Fixes saltstack#67118
dwoz
approved these changes
Nov 23, 2026
This branch was previously deployed
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.
What does this PR do?
What issues does this PR fix or reference?
Fixes #67118
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
No but I'm set up to when wanted.