Repeater, room server, sensor: passwords can no longer be guessed over the air at full speed, and a replayed login no longer floods a reply

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-18 13:03:59 +01:00
1 parent de92ca9ba2
commit dbdae14566
8 files changed
+123

No files matched your search

+10
View File
@@ -350,10 +350,19 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
#if MESH_DEBUG
MESH_DEBUG_PRINTLN("Login, sender not in ACL");
#endif
} else {
// CUSTOM (TeTeHacko): a blank login has a replay floor too -- replayed, it
// gained nothing, but each copy made us flood a reply over the mesh.
if (sender_timestamp <= client->last_timestamp) return;
acl.persistTimestamp(client, sender_timestamp, getRTCClock()->getCurrentTime());
client->last_timestamp = sender_timestamp;
}
}
if (client == NULL) {
uint8_t perm;
// CUSTOM (TeTeHacko): capped wrong passwords (LoginGuard.h); a known admin is never locked out
ClientInfo* known = acl.getClient(sender.pub_key, PUB_KEY_SIZE);
if (login_guard.locked(millis()) && !(known && known->isAdmin())) return;
if (strcmp((char *)&data[8], _prefs.password) == 0) { // check for valid admin password
perm = PERM_ACL_ADMIN;
} else {
@@ -363,6 +372,7 @@ void MyMesh::onAnonDataRecv(mesh::Packet *packet, const uint8_t *secret, const m
perm = PERM_ACL_GUEST;
} else {
MESH_DEBUG_PRINTLN("Incorrect room password");
login_guard.failed(millis()); // CUSTOM (TeTeHacko)
return; // no response. Client will timeout
}
}