Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions client-cpp-gui/include/blackwire/storage/client_state.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,9 @@ inline void from_json(const nlohmann::json& j, LocalMessage& v) {
inline void from_json(const nlohmann::json& j, ConversationMeta& v) {
v.peer_username = j.value("peer_username", "");
v.peer_address = j.value("peer_address", "");
if (j.contains("last_preview")) {
const auto preview = j.value("last_preview", "");
v.last_preview = preview.empty() ? "" : "(encrypted message)";
} else {
v.last_preview = "";
}
// Never deserialize historical last_preview plaintext from disk into runtime state.
// This prevents resurfacing any sensitive previews that may have been persisted.
v.last_preview = "[encrypted message]";
v.last_activity_at = j.value("last_activity_at", "");
}

Expand Down
2 changes: 1 addition & 1 deletion client-cpp-gui/tests/test_state_dedup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ TEST(StateDedupTest, ConversationMetaRoundTrip) {
ASSERT_TRUE(restored.conversation_meta.contains("conv-1"));
const auto& loaded_meta = restored.conversation_meta.at("conv-1");
EXPECT_EQ(loaded_meta.peer_username, "alice");
EXPECT_EQ(loaded_meta.last_preview, "hello");
EXPECT_EQ(loaded_meta.last_preview, "[encrypted message]");
EXPECT_EQ(loaded_meta.last_activity_at, "2026-02-14T12:00:00Z");
}
Loading