commando, chanbackup: use custommsg hooks.
What changed, and why it matters
This commit changes two Core Lightning plugins—commando and chanbackup—so they only process specific peer message types instead of listening to every custom peer message. It is a hardening/refactoring change that narrows what each plugin handles, likely improving performance and reducing the attack surface, but the diff alone does not show a fix for an exploitable vulnerability.
Treat as routine hardening. Review that the intfilters arrays exactly match the message types each handler is designed to parse, and verify the custommsg hook filtering mechanism correctly drops unlisted types before invoking plugins.
Security signals we found
Reduction of hook handler scope via message-type filtering
Defensive hardening of plugin message handling
No explicit security claim in commit message
Evidence from the diff
The patch converts the generic ‘custommsg’ hook registrations in plugins/chanbackup.c and plugins/commando.c to use the new intfilters API, supplying arrays of specific wire message types each plugin cares about (WIRE_PEER_STORAGE/RETRIEVAL for chanbackup; COMMANDO_MSG_CMD_CONTINUES/TERM/REPLY_CONTINUES/TERM for commando). This prevents the plugin from being invoked for unrelated custom messages. There is no evidence in the commit message or diff of a specific security bug being fixed; it reads as an API modernization and defensive hardening change.
Changed components
plugins/chanbackup.cplugins/commando.ccustommsg plugin hookInspect captured patch +17 / −4
diff --git a/plugins/chanbackup.c b/plugins/chanbackup.c
index 3b0d1286..cebd2201 100644
--- a/plugins/chanbackup.c
+++ b/plugins/chanbackup.c
@@ -1126,10 +1126,14 @@ static const struct plugin_notification notifs[] = {
},
};
+static u64 custommsg_types[] = { WIRE_PEER_STORAGE, WIRE_PEER_STORAGE_RETRIEVAL };
+
static const struct plugin_hook hooks[] = {
{
- "custommsg",
- handle_your_peer_storage,
+ .name = "custommsg",
+ .handle = handle_your_peer_storage,
+ .intfilters = custommsg_types,
+ .num_intfilters = ARRAY_SIZE(custommsg_types),
},
{
"peer_connected",
diff --git a/plugins/commando.c b/plugins/commando.c
index f5022be8..d0d2e91c 100644
--- a/plugins/commando.c
+++ b/plugins/commando.c
@@ -603,10 +603,19 @@ static struct command_result *handle_custommsg(struct command *cmd,
return command_hook_success(cmd);
}
+static u64 custommsg_types[] = {
+ COMMANDO_MSG_CMD_CONTINUES,
+ COMMANDO_MSG_CMD_TERM,
+ COMMANDO_MSG_REPLY_CONTINUES,
+ COMMANDO_MSG_REPLY_TERM,
+};
+
static const struct plugin_hook hooks[] = {
{
- "custommsg",
- handle_custommsg
+ .name = "custommsg",
+ .handle = handle_custommsg,
+ .intfilters = custommsg_types,
+ .num_intfilters = ARRAY_SIZE(custommsg_types),
},
};
Why this scored 29/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.