Replace crypt with passlib md5_crypt in scheduler - #333
Open
kasparovabi wants to merge 1 commit into
Open
kasparovabi wants to merge 1 commit into
kasparovabi wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been 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.
#304 moved
Server/bkr/server/model/identity.pyfromcrypt.crypttopasslib.hash.md5_crypt.Server/bkr/server/model/scheduler.pystill hasimport cryptat the top and callscrypt.crypt(group_pw, "$1$%s$" % salt)inRecipe.crypt_root_password. Python 3.13 removed thecryptmodule (PEP 594, What's New in 3.13), so on 3.13 the module import fails before anything inbkr.server.modelloads:This PR applies the same change as #304 to that one call site.
passlibis already a requirement throughidentity.py(python3-passlibinbeaker.specand in the test-py3 container), so nothing new gets pulled in.To check the hashes match I ran, on
python:3.11-slimwith passlib installed, 500 random password and 8-character salt pairs through bothcrypt.crypt(pw, "$1$<salt>$")andmd5_crypt.using(salt=salt).hash(pw). All 500 were identical. The same call onpython:3.13-slimgives the same string for a fixed input ($1$abcdefgh$1y4wFdC1gWzFZU0eph2bJ0forbeaker).I left the
import cryptlines inIntegrationTestsalone (test_kickstart.pyand three selenium tests) to keep this to the server code #304 touched. I can send those separately if you want them. I have not run the Beaker test suite against this branch.I read this diff line by line before opening it, and I am happy to adjust or drop it. What brought me here was a checker I maintain that looks for imports of modules Python has removed, so I am saying that up front rather than leaving you to wonder. If you would rather not get this kind of contribution, tell me and I will not send another.