cln-plugin: return rpc error instead of exiting on invalid json input#9350
Open
daywalker90 wants to merge 1 commit into
Open
cln-plugin: return rpc error instead of exiting on invalid json input#9350daywalker90 wants to merge 1 commit into
daywalker90 wants to merge 1 commit into
Conversation
CLN is too permissive for serde_json when validating json: `lightning-cli -k myplugin-cmd channels='[123456x1x0]'` is valid for lightning-cli but is actually invalid json (bare token in array). The cln-plugin decoder would error and end the FramedRead stream, causing the PluginDriver loop to exit, and therefore exiting the plugin itself. We need to recover the id from the invalid json with a separate parser to return a json rpc error to CLN with the correct id so the rpc command does not hang. Changelog-None
daywalker90
force-pushed
the
cln-plugin-json-relax
branch
from
July 24, 2026 12:52
215507b to
0313961
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CLN is too permissive for serde_json when validating json:
lightning-cli -k myplugin-cmd channels='[123456x1x0]'is valid for lightning-cli but is actually invalid json (bare token in array).
The cln-plugin decoder would error and end the FramedRead stream, causing the PluginDriver loop to exit, and therefore exiting the plugin itself.
We need to recover the id from the invalid json with a separate parser to return a json rpc error to CLN with the correct id so the rpc command does not hang.
Changelog-None
Fixes: #9345