Skip to content

auth/pass_table: Return an error for malformed argon2 hashes instead of panicking - #891

Merged
foxcpp merged 1 commit into
foxcpp:masterfrom
kabeer7121:pass-table-argon2-panic
Nov 8, 2026
Merged

foxcpp merged 1 commit into
foxcpp:masterfrom
kabeer7121:pass-table-argon2-panic

Conversation

@kabeer7121

Copy link
Copy Markdown
Contributor

Part of #888. Ports the verifyArgon2 fix from SCys/maddy@1a15f4153 with a regression test.

verifyArgon2 indexes parts[0..4] without checking how many fields SplitN returned, so a stored argon2: hash with fewer than five :-separated fields (truncated row, hand-edited table, etc.) panics with an index out of range during AUTH. A hash with time or threads set to 0 also panics, inside argon2.IDKey.

This adds a field count check, plus a check for zero time/threads, and returns a "malformed hash string" error in both cases like the other parse failures in that function.

Tested with go test ./internal/auth/.... The new TestVerifyArgon2_Malformed panics on master and passes with this change.

@github-project-automation github-project-automation Bot moved this to First Feedback Needed in Maddy Mail Server PR Review Nov 8, 2026
@foxcpp
foxcpp merged commit 5b3bd17 into foxcpp:master Nov 8, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from First Feedback Needed to Merged in Maddy Mail Server PR Review Nov 8, 2026
@foxcpp

foxcpp commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants