v0.1: Replace SHA-256 local auth with argon2id #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Blocking for v0.1 / any real deployment.
Local auth currently stores passwords as unsalted SHA-256 hex digests (
internal/auth/auth.go) — a deliberate placeholder to keep the scaffold at zero dependencies.Replace with argon2id via
golang.org/x/crypto/argon2:$argon2id$v=19$m=65536,t=3,p=4$<salt>$<hash>) in place ofpasswordSha256cairnd hash-passwordsubcommand so users can generate hashes without external toolspasswordSha256field entirely (no backward compat needed pre-release)This is the first third-party dependency added to the project — note it in ARCHITECTURE.md §1 point 4.
Implemented and pushed to main:
internal/auth/argon2.go— argon2id viax/crypto/argon2, PHC string format, RFC 9106 second recommended parameters (m=64MiB, t=3, p=4). Verification reads parameters from the stored hash, rejects degenerate/absurd params (t=0/p=0 would panic the library; huge m would be a memory DoS), constant-time compare.cairnd hash-passwordsubcommand — reads stdin only, so passwords stay out of shell history andpsoutput.passwordSha256removed entirely; config field is nowpasswordHash.One manual step left for you: go.sum couldn't be generated from my sandbox (no module-proxy access), so run
go mod tidyonce locally and commit the resultinggo.sum. CI has ago mod tidystep as a stopgap until then.