pyln-client: create modern-style notifications if caller doesn't.
What changed, and why it matters
This is a small compatibility fix in the Python plugin client for Core Lightning. It helps older plugin code automatically produce the newer notification format, reducing the chance that a plugin sends a malformed or unexpected message. There is no direct security vulnerability being patched here; it is a robustness improvement.
No immediate security action required. Treat as a routine compatibility/robustness improvement. Reviewers may consider whether `params` could be a non-dict type, which would cause `copy.copy(params)` or key membership checks to behave unexpectedly.
Security signals we found
Input format adaptation in notification path
No validation or sanitization added
No explicit security claim in commit message
Evidence from the diff
The change modifies Plugin.notify() in contrib/pyln-client/pyln/client/plugin.py. If the caller passes parameters that do not already contain the notification method name as a key, the code now wraps the parameters in a dictionary keyed by the method name. This adapts old-style notifications to the modern format expected by Core Lightning, preventing format mismatches.
Changed components
contrib/pyln-client/pyln/client/plugin.pyPlugin.notify() methodInspect captured patch +7 / −0
diff --git a/contrib/pyln-client/pyln/client/plugin.py b/contrib/pyln-client/pyln/client/plugin.py
index 83ee0b5b..24277dca 100644
--- a/contrib/pyln-client/pyln/client/plugin.py
+++ b/contrib/pyln-client/pyln/client/plugin.py
@@ -1,3 +1,4 @@
+import copy
import inspect
import io
import json
@@ -770,6 +771,12 @@ class Plugin(object):
self.stdout.flush()
def notify(self, method: str, params: JSONType) -> None:
+ # Adapt old-style: wrap in method.
+ if method not in params:
+ new_params = copy.copy(params)
+ new_params[method] = params
+ params = new_params
+
payload = {
'jsonrpc': '2.0',
'method': method,
Why this scored 17/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.