Replace SHA256 password hashing with Argon2id for dashboard auth#753
Replace SHA256 password hashing with Argon2id for dashboard auth#753RamXX wants to merge 1 commit intoRightNow-AI:mainfrom
Conversation
Dashboard passwords were hashed with plain SHA256 (no salt), vulnerable to rainbow tables and GPU brute force. Switch to Argon2id with random per-hash salts. Breaking change: existing SHA256 hashes in config.toml must be regenerated with `openfang auth hash-password`.
jaberjaber23
left a comment
There was a problem hiding this comment.
The crypto is solid — correct Argon2id with random salts, OWASP-compliant defaults, PHC format, constant-time verification. The argon2 crate is already trusted in our vault.
However there is a blocking issue: the PR references openfang auth hash-password in the CHANGELOG, docs/configuration.md, and docs/troubleshooting.md. This command does not exist in the CLI. Without it, users have no way to generate Argon2id hashes after upgrading and will be silently locked out of the dashboard.
Please either add the CLI subcommand or update the docs to reference an alternative method.
Also recommend adding a startup warning when auth.enabled = true and password_hash doesn't start with $argon2 so users know why login fails after upgrade.
Summary
Dashboard password hashing used plain SHA256 without a salt. SHA256 is a general-purpose hash, not a password hash: it is fast to compute and vulnerable to rainbow tables and GPU-accelerated brute force. This replaces it with Argon2id, the OWASP-recommended password hashing algorithm, using the PHC string format with random per-hash salts.
This is a breaking change for users who have dashboard auth enabled (
[auth] enabled = true). Existing SHA256 hashes inconfig.tomlwill no longer be accepted. To upgrade, runopenfang auth hash-password, paste the new hash intoconfig.toml, and restart the daemon. Dashboard auth is opt-in (disabled by default), so most users are unaffected.No new dependencies are introduced. Both
argon2andrandwere already in the workspace (used byopenfang-extensionsfor credential vault key derivation); this PR adds them toopenfang-api's Cargo.toml.Changes
hash_password()now produces Argon2id PHC strings with random saltsverify_password()only accepts Argon2id hashes (rejects legacy SHA256)AuthConfig::password_hashdoc comment to reflect the new format[auth]section todocs/configuration.md(was previously undocumented)docs/troubleshooting.mdFAQ to reference built-in dashboard auth instead of reverse proxy workaroundCHANGELOG.mdTesting
cargo clippy --workspace --all-targets -- -D warningspassescargo test --workspacepassesSecurity