harden: gate key-export/PIN over unauthenticated USB companion

Add virtual BaseSerialInterface::isConnectionSecure() (default true). On the dual interface it is true only for MITM-paired BLE. Gate CMD_EXPORT_PRIVATE_KEY and CMD_SET_DEVICE_PIN, and hide the BLE PIN in CMD_DEVICE_QUERY, when the frame arrived over unauthenticated USB.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 4.8 committed 2026-07-11 19:21:11 +02:00
1 parent acf1b627a2
commit a5fd4b7488
2 files changed
+37 -15

No files matched your search

+8
View File
@@ -18,4 +18,12 @@ public:
virtual bool isWriteBusy() const = 0;
virtual size_t writeFrame(const uint8_t src[], size_t len) = 0;
virtual size_t checkRecvFrame(uint8_t dest[]) = 0;
// Whether the transport carrying the current / most-recent frame is
// authenticated. A single-transport interface is trusted by definition
// (physically-connected USB, or a MITM-paired BLE link), so the default is
// true. Multi-transport wrappers (e.g. SerialDualInterface) override this to
// distinguish an unauthenticated local channel (USB) from a paired one, so
// callers can gate sensitive commands (key export, PIN read/set).
virtual bool isConnectionSecure() const { return true; }
};