Use signed storage role and reject revoked key recipients

This commit is contained in:
evgeny committed 2026-10-18 10:37:12 +02:00
1 parent fd61aedce3
commit 01e1772615
2 files changed
+3 -2

No files matched your search

+2 -1
View File
@@ -448,7 +448,8 @@ void chat_attachment_want(struct UTUN_INSTANCE* inst, const char* channel, const
/* Автозагрузка обычного участника запрашивает доступ; storage-реплика хранит только ciphertext. */
void chat_attachment_downloaded(struct UTUN_INSTANCE* inst, const char* channel, const uint8_t message[32]) {
char sql[256]; snprintf(sql, sizeof(sql), "UPDATE attachment_keys SET downloaded=1,wanted=max(wanted,"
"NOT EXISTS(SELECT 1 FROM peers_%s WHERE node_id=? AND storage=1)) WHERE channel=? AND message_id=?", channel);
"NOT EXISTS(SELECT 1 FROM peers_%s WHERE node_id=? AND source=0 AND deleted=0 AND length(adm_tags_sig)=64"
" AND json_extract(adm_tags,'$.storage')='yes')) WHERE channel=? AND message_id=?", channel);
sqlite3_stmt* st = ak_prepare(inst, sql);
if (!st) return;
sqlite3_bind_int64(st, 1, (sqlite3_int64)inst->node_id); sqlite3_bind_text(st, 2, channel, -1, SQLITE_STATIC);
+1 -1
View File
@@ -1216,7 +1216,7 @@ int member_sync_count(struct UTUN_INSTANCE* inst, const char* ch_id) {
int member_sync_verified_ed25519(struct UTUN_INSTANCE* inst, const char* channel, uint64_t author, uint8_t key[32]) {
char sql[384];
snprintf(sql, sizeof(sql), "SELECT x25519_pubkey,ed25519_pubkey,signed_by,signature,join_sig,join_ts"
" FROM peers_%s WHERE node_id=? AND source=0", channel);
" FROM peers_%s WHERE node_id=? AND source=0 AND deleted=0", channel);
sqlite3_stmt* st = NULL; sqlite3* db = inst->topo_sqlite_db;
if (sqlite3_prepare_v2(db, sql, -1, &st, NULL) != SQLITE_OK) { DEBUG_ERROR(DEBUG_CATEGORY_MEMBER_SYNC, "verified member lookup: %s", sqlite3_errmsg(db)); return -1; }
sqlite3_bind_int64(st, 1, (sqlite3_int64)author);