feat(mqtt): add opt-in advert signature check before publishing

Received packets are uploaded before Mesh::onRecvPacket validates them, so
an advert corrupted over the air that still passes the LoRa CRC is published
with a mangled name or location. `set mqtt.advert.verify on` verifies each
received advert's Ed25519 signature (same message layout as Mesh.cpp,
including the 32-byte app-data clamp) and skips publishing failures.

Defaults off so collectors keep seeing RF corruption on the mesh. Dropped
adverts are counted as badsig= in `get mqtt.stats`. Exposed in the web
config Publishing card and persisted as mqtt.advert_verify in prefs JSON.
This commit is contained in:
agessaman committed 2026-10-07 20:07:36 -07:00
1 parent 64276e5d92
commit 4716410bc2
15 files changed
+206 -6

No files matched your search

+3 -2
View File
@@ -117,7 +117,7 @@ def default_config(setup_mode):
},
"mqtt": {
"origin": "" if setup_mode else "MockNode", "iata": "" if setup_mode else "DEN",
"status": True, "packets": True, "raw": False, "tx": "advert", "rx": True,
"status": True, "packets": True, "raw": False, "tx": "advert", "rx": True, "advert_verify": False,
"interval": 5, "timezone": "MST7MDT,M3.2.0,M11.1.0", "timezone_offset": -7,
"ntp": "pool.ntp.org", "owner": "", "email": "", "snmp": False,
"snmp_community": "public",
@@ -216,7 +216,8 @@ class State:
BOOL_KEYS = {"cad": ("radio", "cad"), "radio.rxgain": ("radio", "rxgain"),
"repeat": ("radio", "repeat"), "mqtt.status": ("mqtt", "status"),
"mqtt.packets": ("mqtt", "packets"), "mqtt.raw": ("mqtt", "raw"),
"mqtt.rx": ("mqtt", "rx"), "snmp": ("mqtt", "snmp"),
"mqtt.rx": ("mqtt", "rx"), "mqtt.advert.verify": ("mqtt", "advert_verify"),
"snmp": ("mqtt", "snmp"),
"mqtt.neighbors": ("mqtt", "neighbors")}
INT_KEYS = {"tx": ("radio", "tx"), "flood.max": ("radio", "flood_max"),
"flood.max.advert": ("radio", "flood_max_advert"),