Repository navigation
Conversation
basic_auth and hash-password only accepted the built-in bcrypt and argon2id algorithms, even though the http.authentication.hashes namespace is documented as extensible. Look up any other algorithm name among the installed hash modules instead, and list the available ones when the name is not recognized. The built-in algorithms keep their own hash-password flags; other modules are provisioned and must implement Hasher to generate hashes. Closes caddyserver#6670
steadytao
requested changes
Sep 26, 2026
Member
|
Also. You must sign the CLA. |
hash-password printed module hashes as raw bytes, but basic_auth base64-decodes any password that isn't in Modular Crypt Format, so the output couldn't be used as-is. Encode non-MCF hashes as base64 and add a round-trip test that provisions HTTPBasicAuth with the command output.
Author
|
Thanks, fixed in 7deb2fd. I'll sign the CLA. |
steadytao
approved these changes
Sep 26, 2026
steadytao
left a comment
Member
There was a problem hiding this comment.
You must sign the CLA but otherwise LGTM.
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.
Closes #6670
basic_authandcaddy hash-passwordonly acceptedbcryptandargon2id, even though thehttp.authentication.hashesnamespace is documented as pluggable. Any other algorithm name is now looked up among the installed hash modules viacaddy.GetModules.basic_auth <name>: the module must implementComparer; the adapted JSON is"hash": {"algorithm": "<name>"}(unchanged for bcrypt/argon2id).hash-password --algorithm <name>: bcrypt/argon2id keep their dedicated flags; other modules are provisioned and must implementHasher.unrecognized hash algorithm: nope (available: argon2id, bcrypt).Tests register a dummy hash module and cover Caddyfile adaptation, provisioning/comparison through the module, the hash-password command, and the error cases (unknown name, compare-only module used with hash-password).
Assistance Disclosure
I used AI assistants (Claude, OpenAI models) while writing and reviewing this change; I verified the behaviour and tests myself.