What changed, and why it matters
This change adjusts how the Monero wallet decides whether it is saving to the same file. Previously, the wallet only skipped certain path checks when no new path was provided. Now it also skips those checks when the requested path is exactly the current wallet file. The likely goal is to avoid path canonicalization, which can fail or behave unexpectedly on unusual filesystems, symlinks, or restricted environments. The patch is very small and defensive, and there is no direct evidence it fixes an active security vulnerability.
Treat as a minor hardening fix. Review whether other wallet path operations rely on canonicalization for security boundaries, and ensure tests cover saving via explicit current filename, symlinks, and read-only parent directories. No urgent action is indicated absent a disclosed advisory.
Security signals we found
Filesystem path canonicalization bypassed for current file
Defensive hardening around wallet save path handling
Potential symlink/permissions edge case mitigated
Evidence from the diff
In wallet2::store_to(), the same_file condition was broadened from path.empty() to path.empty() || path == m_wallet_file. The subsequent canonicalization block now runs only when the destination is genuinely different from the current wallet file. This avoids boost::filesystem canonicalization when the caller explicitly passes the current filename, reducing exposure to filesystem edge cases (symlinks, inaccessible parent directories, permission issues, or platform-specific canonicalization failures) during wallet save operations.
Changed components
src/wallet/wallet2.cppwallet2::store_to()wallet save/cache file logicInspect captured patch +3 / −3
### src/wallet/wallet2.cpp
@@ -7139,9 +7139,9 @@ void wallet2::store_to(const std::string &path, const epee::wipeable_string &pas
// 4. store new cache file
// 5. remove old cache file
- // handle if we want just store wallet state to current files (ex store() replacement);
- bool same_file = had_old_wallet_files && path.empty();
- if (had_old_wallet_files && !path.empty())
+ // Avoid canonicalizing paths when explicitly saving to the current wallet file.
+ bool same_file = had_old_wallet_files && (path.empty() || path == m_wallet_file);
+ if (had_old_wallet_files && !same_file)
{
const std::string canonical_old_path = boost::filesystem::canonical(m_wallet_file).string();
const std::string canonical_new_path = boost::filesystem::weakly_canonical(path).string();Why this scored 35/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.