Skip to content

fix dropped errors#1

Open
alrs wants to merge 1 commit into
dwin:masterfrom
alrs:password-errs
Open

fix dropped errors#1
alrs wants to merge 1 commit into
dwin:masterfrom
alrs:password-errs

Conversation

@alrs
Copy link
Copy Markdown

@alrs alrs commented Mar 5, 2026

This fixes three dropped err variables in password.go. Unit tests continue to pass after these changes.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(...) in Hash.
  • Add missing error checks after base64-decoding the stored salt in updateMasterV1 and verifyV1.
Comments suppressed due to low confidence (1)

password.go:213

  • New early-return on invalid base64 salt in verifyV1 isn’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 thread password.go
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 thread password.go
Comment on lines 63 to +66
userpassScrypt, err := scryptHash(hex.EncodeToString(userPwBlake[:]), nil, userparams)

if err != nil {
return "", err
}
Comment thread password.go
Comment on lines 140 to +143
salt, err := base64.StdEncoding.DecodeString(parts[3])
if err != nil {
return "", err
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants