hsmd: don't report forced channel secrets as memleaks
What changed, and why it matters
This is a tiny developer-only fix for a memory-leak false alarm. When running tests with a special developer flag that forces fixed channel secrets, those secrets were wrongly reported as leaked memory during test teardown. The patch tells the memory-leak checker to ignore them, matching two similar developer-only flags already excluded. It does not change normal node behavior or affect production wallets.
No security action required. Treat as a normal test/QA fix. If reviewing, verify that the two added pointers are indeed the only allocations associated with --dev-force-channel-secrets and that they are intentionally long-lived.
Security signals we found
Developer-only test option, not reachable in production builds
No change to secret handling, cryptography, or access control
Fixes a false-positive memleak report, not an actual memory leak
No privilege escalation, remote trigger, or data exposure introduced
Evidence from the diff
The commit adds two more allocations (dev_force_channel_secrets and dev_force_channel_secrets_shaseed) to the hsmd dev-memleak whitelist in handle_memleak(). These allocations are made off NULL at daemon initialization and intentionally kept for the lifetime of the process when –dev-force-channel-secrets is used, analogous to dev_force_privkey and dev_force_bip32_seed. Without the whitelist entries, tests using the developer option fail teardown with spurious memleak reports.
Changed components
hsmd/hsmd.chandle_memleak()dev-memleak developer RPC/toolingInspect captured patch +2 / −0
### hsmd/hsmd.c
@@ -658,6 +658,8 @@ static struct io_plan *handle_memleak(struct io_conn *conn,
memleak_ptr(memtable, dev_force_privkey);
memleak_ptr(memtable, dev_force_bip32_seed);
+ memleak_ptr(memtable, dev_force_channel_secrets);
+ memleak_ptr(memtable, dev_force_channel_secrets_shaseed);
found_leak = dump_memleak(memtable, memleak_status_broken, NULL);
reply = towire_hsmd_dev_memleak_reply(NULL, found_leak);Why this scored 18/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.