mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 07:04:22 +01:00
plugin: Prevent plugins from registering native notification topics
They may already have subscribers, and they may crash if presented with a malformed notification.
This commit is contained in:
committed by
Rusty Russell
parent
f716c55983
commit
c8c2c33952
@@ -1327,6 +1327,14 @@ static const char *plugin_notifications_add(const char *buffer,
|
||||
i);
|
||||
|
||||
name = json_strdup(plugin->plugins, buffer, method);
|
||||
|
||||
if (notifications_topic_is_native(name))
|
||||
return tal_fmt(plugin,
|
||||
"plugin attempted to register a native "
|
||||
"notification topic \"%s\", these may "
|
||||
"however only be sent by lightningd",
|
||||
name);
|
||||
|
||||
tal_arr_expand(&plugin->plugins->notification_topics, name);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user