From 89e2a2f22b21e5e7532755dd7ed8a10bf2d81d3a Mon Sep 17 00:00:00 2001 From: evgeny Date: Tue, 27 Oct 2026 07:31:16 +0100 Subject: [PATCH] test(chat): reject a valid signed profile stored with the wrong SQLite type --- tests/test_chat_profile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_chat_profile.c b/tests/test_chat_profile.c index f2d02fea..1aa480d3 100644 --- a/tests/test_chat_profile.c +++ b/tests/test_chat_profile.c @@ -346,6 +346,9 @@ static void set_profile_row(struct UTUN_INSTANCE* inst, const char* json, const static void damaged_profile(struct UTUN_INSTANCE* inst) { char json[MS_USERINFO_MAX + 1]; uint8_t signature[64], changed[64], body[MS_USERINFO_MAX + 73]; uint64_t version; assert(!chat_core_get_my_profile(inst, channel, json, sizeof(json), signature, &version)); + char sql[192]; snprintf(sql, sizeof(sql), "UPDATE peers_%s SET userinfo=CAST(userinfo AS BLOB) WHERE node_id=%lld", channel, (long long)inst->node_id); + assert(sqlite3_exec(inst->topo_sqlite_db, sql, NULL, NULL, NULL) == SQLITE_OK); read_refused(inst); refused(inst); + set_profile_row(inst, json, signature, version, original_join); set_profile_row(inst, "{\"untrusted\":\"do not sign\"}", signature, version, original_join); read_refused(inst); refused(inst); set_profile_row(inst, json, signature, version, original_join); memcpy(changed, original_join, 64); changed[0] ^= 1;