cln-subscribe-wildcard: properly handle shutdown notification with an exit
What changed, and why it matters
This commit fixes a minor quality-of-life issue in an example plugin. The plugin now exits cleanly when it receives a shutdown message, instead of hanging until test cleanup forcibly kills it. It is not a security vulnerability and does not expose user funds or node control to attackers.
No security action required. Treat as normal code-quality/test-reliability improvement.
Security signals we found
No security-relevant signals present
Change is in example/test plugin code only
No input validation, authorization, or cryptographic changes
Evidence from the diff
The example Rust plugin cln-subscribe-wildcard.rs previously ignored shutdown notifications, so during pytest teardown Core Lightning had to wait the full plugin-kill timeout before terminating the plugin. The patch deserializes incoming notifications via cln_rpc::Notification and calls std::process::exit(0) on Notification::Shutdown. The Cargo files add cln-rpc as a dev/example dependency to make the type available. This is a cleanup/UX fix, not a memory-safety, authorization, or remote-exploitable bug.
Changed components
plugins/examples/cln-subscribe-wildcard.rsplugins/Cargo.tomlCargo.lockInspect captured patch +7 / −0
diff --git a/Cargo.lock b/Cargo.lock
index 8be7a287..1b2f97ed 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -504,6 +504,7 @@ dependencies = [
"anyhow",
"bytes",
"cln-grpc",
+ "cln-rpc",
"futures",
"log",
"serde",
diff --git a/plugins/Cargo.toml b/plugins/Cargo.toml
index 421b0476..4991e9dc 100644
--- a/plugins/Cargo.toml
+++ b/plugins/Cargo.toml
@@ -35,3 +35,4 @@ tracing = { version = "^0.1", features = ["async-await", "log"] }
[dev-dependencies]
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
cln-grpc = { workspace = true }
+cln-rpc = { workspace = true }
diff --git a/plugins/examples/cln-subscribe-wildcard.rs b/plugins/examples/cln-subscribe-wildcard.rs
index c403e3ee..a8e67167 100644
--- a/plugins/examples/cln-subscribe-wildcard.rs
+++ b/plugins/examples/cln-subscribe-wildcard.rs
@@ -22,6 +22,11 @@ async fn main() -> Result<()> {
async fn handle_wildcard_notification(_plugin: Plugin<()>, value: serde_json::Value) -> Result<()> {
let notification_type: String = value.as_object().unwrap().keys().next().unwrap().into();
+ let notification: cln_rpc::Notification = serde_json::from_value(value)?;
+
+ if let cln_rpc::Notification::Shutdown(_shutdown_notification) = notification {
+ std::process::exit(0);
+ }
log::info!("Received notification {}", notification_type);
Ok(())
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.