Companion: the private key and the BLE PIN are again refused over USB, UART and WiFi -- only paired BLE gets them
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cac3249e41
commit
769139999d
5 files changed
+173
-10
No files matched your search
@@ -1098,7 +1098,7 @@ void MyMesh::handleCmdFrame(size_t len) {
|
||||
i += 20;
|
||||
out_frame[i++] = _prefs.isRepeatEn() ? 1 : 0; // v9+
|
||||
out_frame[i++] = _prefs.path_hash_mode; // v10+
|
||||
_serial->writeFrame(out_frame, i);
|
||||
_serial->writeReplyFrame(out_frame, i); // carries the PIN: never to the other transports
|
||||
} else if (cmd_frame[0] == CMD_APP_START &&
|
||||
len >= 8) { // sent when app establishes connection, respond with node ID
|
||||
// cmd_frame[1..7] reserved future
|
||||
@@ -1148,7 +1148,11 @@ void MyMesh::handleCmdFrame(size_t len) {
|
||||
text[tlen] = 0; // ensure null
|
||||
|
||||
reply_buf[0] = 0;
|
||||
if (!handleCommand(text, 0, reply_buf)) {
|
||||
if (memcmp(text, "set pin ", 8) == 0 && !_serial->isConnectionSecure()) {
|
||||
// CUSTOM (TeTeHacko): the same gate as CMD_SET_DEVICE_PIN -- through the
|
||||
// CLI, USB set the PIN it may not set directly, then paired over BLE
|
||||
strcpy(reply_buf, "Error: set pin only over paired BLE");
|
||||
} else if (!handleCommand(text, 0, reply_buf)) {
|
||||
strcat(reply_buf, "Unknown command"); // reply_buf may have cmd prefix from 'text'
|
||||
}
|
||||
out_frame[0] = RESP_CODE_CLI_REPLY;
|
||||
@@ -1569,7 +1573,7 @@ void MyMesh::handleCmdFrame(size_t len) {
|
||||
uint8_t reply[65];
|
||||
reply[0] = RESP_CODE_PRIVATE_KEY;
|
||||
self_id.writeTo(&reply[1], 64);
|
||||
_serial->writeFrame(reply, 65);
|
||||
_serial->writeReplyFrame(reply, 65); // only back to the paired BLE peer, not out on USB too
|
||||
}
|
||||
#else
|
||||
writeDisabledFrame();
|
||||
|
||||
Reference in new issue
Block a user