feat(repeater): antispam — FairnessLimiter (port #1502) + kanálový deny list

Reakce na 5. 9.: ujetý AI bot lil 11dílný Gemini 429 dump na #meshcore
(99 ze 100 posledních zpráv kanálu) a naše repeatery ho poslušně šířily.

Vrstva A — FairnessLimiter (port Beanowovy větve beanow/wp-repeat,
upstream návrh meshcore-dev/MeshCore#1502): token buckety nad
FORWARDOVANÝM provozem, klíčované 1B identifikátory v plaintextu
(channel hash / src hash / pubkey[0]). Nový virtual
Mesh::takeForwardingRateLimit() jako poslední podmínka všech čtyř
forward rozhodnutí. DIRECT se nelimituje. Odchylky od originálu: bez
RTC závislosti (logy přes MESH_DEBUG_PRINTLN), bounds guardy na
payload_len. Kill switch: `fairness on|off` (persistovaný pref).

Vrstva B — ChannelFilter: repeater se znalostí PSK (committed
[channel_filter] — klíče hashtag kanálů jsou SHA256(jméno)[:16],
tedy veřejné z konstrukce; derivace ověřená na 0xEF z éteru)
dešifruje GRP_TXT a zprávy odesílatelů z runtime deny listu
odmítne přeposlat (markDoNotRetransmit, stejný mechanismus jako
ANON větev). CLI `filter add|del|list|clear`, seznam v NodePrefs.
Jméno je spoofovatelné — je to zadržení ujetého bota, ne security;
příjem a rxlog/pktfeed (CoreScope) nedotčené. Fork-only, upstream
by to nevzal (privacy/no-censorship, viz diskuze u #169).

ChannelBot refactor: registr kanálů + parse sdílené v ChannelCommon.h
(bot = botOnChannelText), čisté helpery v ChanListUtil.h kvůli native
testům. Nové testy test_fairness_limiter + test_chan_list (native i
ASAN, 164/164 zelených).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Fable 5 committed 2026-09-05 21:35:36 +02:00
1 parent 7fbcf07aee
commit 04838e8492
15 files changed
+1098 -112

No files matched your search

+13
View File
@@ -19,6 +19,17 @@ extra_configs =
[secrets]
ble_pin = 123456
; CUSTOM (TeTeHacko): channels the ChannelFilter deny list applies to
; (examples/simple_repeater/ChannelFilter.h). These keys are PUBLIC by
; construction, not secrets: hashtag channels derive key = SHA256(name)[:16]
; (anyone joins #meshcore by typing the name), and the Public channel key is
; the globally published izOH6cXN6mrJ5e26oRXNcg==. Derivation verified live
; 5. 9. 2026: SHA256("#meshcore")[:16] hashes to channel byte 0xEF, matching
; the on-air packets. Order: #meshcore, Public, #test.
[channel_filter]
build_flags =
-D FILTER_CHANNEL_PSKS='"2fa78a5aef618e7c2a78f0ab5c8869b3,8b3387e9c5cdea6ac9e5edbaa115cd72,9cd8fcf22a47333b591d96a2b848b73f"'
[arduino_base]
framework = arduino
monitor_speed = 115200
@@ -185,6 +196,7 @@ build_src_filter =
+<../src/Packet.cpp>
+<../src/helpers/ConfigSerializer.cpp>
+<../src/helpers/DynamicConfigSerializer.cpp>
+<../src/helpers/FairnessLimiter.cpp>
lib_deps =
google/googletest @ 1.17.0
@@ -223,6 +235,7 @@ build_src_filter =
+<../src/Packet.cpp>
+<../src/helpers/ConfigSerializer.cpp>
+<../src/helpers/DynamicConfigSerializer.cpp>
+<../src/helpers/FairnessLimiter.cpp>
lib_deps =
google/googletest @ 1.17.0