[PM-30370] Add salt to vault sync response#7248
Conversation
…l fallbacks to use GetMasterPasswordSalt
|
Claude finished @ike-kottlowski's task in 2m 47s —— View job Code Review: PM-30370 Add salt to vault sync response
Critical Finding
The method currently always returns public string GetMasterPasswordSalt()
{
return Email.ToLowerInvariant().Trim();
}This means:
The fix should add a null-coalescing fallback in the method: public string GetMasterPasswordSalt()
{
return MasterPasswordSalt ?? Email.ToLowerInvariant().Trim();
}Other Changes Look Good
All tests are well-structured and will pass once |
| }, | ||
| MasterKeyEncryptedUserKey = user.Key!, | ||
| Salt = user.Email.ToLowerInvariant() | ||
| Salt = user.GetMasterPasswordSalt() |
There was a problem hiding this comment.
❌ CRITICAL: GetMasterPasswordSalt() never reads User.MasterPasswordSalt -- it always returns Email.ToLowerInvariant().Trim(), so the new explicit-salt tests will fail and the feature does not work.
Details and fix
Commit 0240c94ad message says "add null coalesce to GetMasterPasswordSalt" but the method body in src/Core/Entities/User.cs line 117-120 was never updated:
public string GetMasterPasswordSalt()
{
return Email.ToLowerInvariant().Trim();
}It should be:
public string GetMasterPasswordSalt()
{
return MasterPasswordSalt ?? Email.ToLowerInvariant().Trim();
}Without this change, both Get_HaveExplicitMasterPasswordSalt_SaltReturnedInSync and Constructor_UserWithExplicitSalt_UsesMasterPasswordSalt will fail because they set MasterPasswordSalt = "explicit-salt-value" but the method ignores it and returns the email.
| }, | ||
| MasterKeyEncryptedUserKey = user.Key!, | ||
| Salt = user.Email.ToLowerInvariant() | ||
| Salt = user.GetMasterPasswordSalt() |
There was a problem hiding this comment.
🚨 CRITICAL — GetMasterPasswordSalt() in src/Core/Entities/User.cs:117-120 never checks the MasterPasswordSalt property — it always returns Email.ToLowerInvariant().Trim(). The two new tests that set MasterPasswordSalt = "explicit-salt-value" will fail.
Suggested fix in User.cs:
public string GetMasterPasswordSalt()
{
return MasterPasswordSalt ?? Email.ToLowerInvariant().Trim();
}
|
|
Great job! No new security vulnerabilities introduced in this pull request |




🎟️ Tracking
PM-30370
📔 Objective
On sync retrieve the
User.GetMasterPasswordSalt()method instead of the email.