fix dropped errors#1
Open
alrs wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR improves error propagation in the password hashing/encryption workflow by ensuring previously ignored errors are checked and returned to callers, preventing silent generation of invalid hashes or unsafe continuation on malformed ciphertext inputs.
Changes:
- Add missing error check after
scryptHash(...)inHash. - Add missing error checks after base64-decoding the stored salt in
updateMasterV1andverifyV1.
Comments suppressed due to low confidence (1)
password.go:213
- New early-return on invalid base64 salt in
verifyV1isn’t exercised by the test suite. Consider adding a test case with a ciphertext whose salt segment (parts[3]) is invalid base64 and assert verification returns an error.
salt, err := base64.StdEncoding.DecodeString(parts[3])
if err != nil {
return err
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+64
to
68
| if err != nil { | ||
| return "", err | ||
| } | ||
| // 3) Encrypt userpass Scrypt output with secretbox XSalsa20-Poly1305 encryption-authentication method using random 24 byte nonce and masterpass Scrypt hash | ||
| encrypted, salt, err := encrypt(masterpass, userpassScrypt, masterparams) |
Comment on lines
63
to
+66
| userpassScrypt, err := scryptHash(hex.EncodeToString(userPwBlake[:]), nil, userparams) | ||
|
|
||
| if err != nil { | ||
| return "", err | ||
| } |
Comment on lines
140
to
+143
| salt, err := base64.StdEncoding.DecodeString(parts[3]) | ||
| if err != nil { | ||
| return "", err | ||
| } |
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.
This fixes three dropped
errvariables inpassword.go. Unit tests continue to pass after these changes.