Commit 7ca7ae3
Fix invalid password hash error message
Previously, posting definitions with an invalid password hash (e.g.,
"password_hash": "invalid_hash") resulted in an unhelpful error:
"Negative count: -10"
This occurred because the password parsing code didn't validate the
decoded hash size before extracting the salt, causing ArgumentError
when salt_size became negative.
Added validation to catch:
- Invalid Base64 encoding in password hashes
- Decoded hash size smaller than required digest size
Now returns clear error messages:
- "Invalid password hash: not valid Base64 encoding (...)"
- "Invalid password hash: decoded size X bytes is smaller than required
digest size Y bytes for <algorithm>"
Also added test coverage for:
- Invalid password hash error handling
- Exchange-to-exchange bindings in definitions upload
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 2519c5b commit 7ca7ae3
2 files changed
+30
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
226 | 226 | | |
227 | 227 | | |
228 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
229 | 249 | | |
| 250 | + | |
230 | 251 | | |
231 | 252 | | |
232 | 253 | | |
| |||
581 | 602 | | |
582 | 603 | | |
583 | 604 | | |
| 605 | + | |
584 | 606 | | |
585 | 607 | | |
586 | 608 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
0 commit comments