test(chat): reject a valid signed profile stored with the wrong SQLite type

This commit is contained in:
evgeny committed 2026-10-27 07:31:16 +01:00
1 parent 9342795008
commit 89e2a2f22b
1 file changed
+3
+3
View File
@@ -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;