test: unset force_simradio so admin request pinning is exercised
The native test harness boots Portduino in simulated mode, and
wouldEncryptWithPKC() short-circuits to false whenever
portduino_config.force_simradio is set. noteOutgoingAdminRequest() derives its
pin from that predicate:
keyValid = haveDestKey && wouldEncryptWithPKC(&p, p.channel, haveDestKey);
so under the harness no outgoing admin request is ever key-pinned, and
responseIsSolicited() admits a plaintext response to a PKC-pinned request.
test_pinned_request_keeps_its_key_after_an_unpinned_request and
test_request_to_keyed_node_pins_the_stored_key have therefore failed since
#11092 added them, on develop and on every branch that merges it.
Instrumenting the predicate shows every other term already satisfied
(haveDestKey=1, isFromUs=1, private_key=32, unicast, ADMIN_APP, channel
LongFast) with wouldEncryptWithPKC=0, leaving only the simradio guard.
Clear the flag in setUp so the fixture models a real device. Skipping PKC under
force_simradio is correct for a simulated radio - there is no PKC to pin - so
the predicate is left alone rather than relaxed to make a test pass. The only
sim-mode path in this suite is AdminModule's exit_simulator intercept, which no
test here exercises.
Native suite: 38 suites, 723/723 cases, no sanitizer findings.
This commit is contained in:
@@ -21,6 +21,10 @@
|
||||
#include "support/MockMeshService.h"
|
||||
#include <cstring>
|
||||
|
||||
#ifdef ARCH_PORTDUINO
|
||||
#include "platform/portduino/PortduinoGlue.h"
|
||||
#endif
|
||||
|
||||
static constexpr NodeNum LOCAL_NODE = 0x0A0A0A0A;
|
||||
static constexpr NodeNum ADMIN_NODE = 0x0B0B0B0B; // authorized admin, sends remote admin to us
|
||||
static constexpr NodeNum QUERIED_NODE = 0x0C0C0C0C; // a remote we send admin requests to
|
||||
@@ -157,6 +161,14 @@ void setUp(void)
|
||||
nodeDB = mockNodeDB;
|
||||
myNodeInfo.my_node_num = LOCAL_NODE;
|
||||
|
||||
#ifdef ARCH_PORTDUINO
|
||||
// The native test harness boots Portduino in simulated mode, and wouldEncryptWithPKC()
|
||||
// hard-disables PKC whenever force_simradio is set. Left true, no outgoing admin request is
|
||||
// ever key-pinned, so the pinning tests below cannot exercise what they are asserting.
|
||||
// Model a real (non-sim) device instead.
|
||||
portduino_config.force_simradio = false;
|
||||
#endif
|
||||
|
||||
config = meshtastic_LocalConfig_init_zero;
|
||||
// A real device always holds a private key; without one perhapsEncode never picks PKC.
|
||||
config.security.private_key.size = 32;
|
||||
|
||||
Reference in New Issue
Block a user