From c3396b7ae59b38e46d0b3d3bc5689ea62d67edc8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:21:08 +0000 Subject: [PATCH 1/4] Initial plan From bd703f2e042a5d0df6a84500c5f861bd03f7866b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:23:32 +0000 Subject: [PATCH 2/4] fix: preserve last_preview in ConversationMeta deserialization Co-authored-by: WilleLX1 <68472201+WilleLX1@users.noreply.github.com> --- client-cpp-gui/include/blackwire/storage/client_state.hpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/client-cpp-gui/include/blackwire/storage/client_state.hpp b/client-cpp-gui/include/blackwire/storage/client_state.hpp index 5b212c1..226fb1a 100644 --- a/client-cpp-gui/include/blackwire/storage/client_state.hpp +++ b/client-cpp-gui/include/blackwire/storage/client_state.hpp @@ -122,12 +122,7 @@ 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 = ""; - } + v.last_preview = j.value("last_preview", ""); v.last_activity_at = j.value("last_activity_at", ""); } From 577d94bf26e6d13f5b8bad788bd871a4ef0b9a97 Mon Sep 17 00:00:00 2001 From: wdani <68472201+WilleLX1@users.noreply.github.com> Date: Fri, 6 Mar 2026 16:34:07 +0100 Subject: [PATCH 3/4] Update client-cpp-gui/include/blackwire/storage/client_state.hpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- client-cpp-gui/include/blackwire/storage/client_state.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client-cpp-gui/include/blackwire/storage/client_state.hpp b/client-cpp-gui/include/blackwire/storage/client_state.hpp index 226fb1a..b2def93 100644 --- a/client-cpp-gui/include/blackwire/storage/client_state.hpp +++ b/client-cpp-gui/include/blackwire/storage/client_state.hpp @@ -122,7 +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", ""); - v.last_preview = j.value("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", ""); } From 24f74672efe40a1663c1a1b25e949817f63bab26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:37:15 +0000 Subject: [PATCH 4/4] fix: update test to expect masked last_preview after deserialization Co-authored-by: WilleLX1 <68472201+WilleLX1@users.noreply.github.com> --- client-cpp-gui/tests/test_state_dedup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client-cpp-gui/tests/test_state_dedup.cpp b/client-cpp-gui/tests/test_state_dedup.cpp index 789d716..559dce9 100644 --- a/client-cpp-gui/tests/test_state_dedup.cpp +++ b/client-cpp-gui/tests/test_state_dedup.cpp @@ -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"); }