autogenerate-rpc-examples: sanitize plugin paths in plugin examples
What changed, and why it matters
This commit changes a test helper script that auto-generates documentation examples for the 'plugin' RPC command. It replaces real build-directory plugin paths with a generic '/usr/local/libexec/plugins/' path so the generated examples look clean and consistent. There is no change to the actual Core Lightning node code, no security fix, and no vulnerability.
No security action needed. Treat as a normal test/documentation hygiene commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff adds fixup_plugin() to tests/autogenerate-rpc-examples.py. The function canonicalizes plugin paths in generated RPC examples by taking only the basename and prefixing it with /usr/local/libexec/plugins/. It is invoked on examples[‘plugin’][‘examples’] during documentation generation. The change is purely cosmetic for docs and does not touch runtime plugin loading, path validation, or any node logic.
Changed components
tests/autogenerate-rpc-examples.pyInspect captured patch +16 / −0
diff --git a/tests/autogenerate-rpc-examples.py b/tests/autogenerate-rpc-examples.py
index 199c8652..4d8e171d 100644
--- a/tests/autogenerate-rpc-examples.py
+++ b/tests/autogenerate-rpc-examples.py
@@ -174,6 +174,19 @@ def fixup_listconfigs(configvars: Dict[str, Dict[str, Any]]) -> Dict[str, Dict[s
key=lambda kv: (1, kv[1]["plugin"], kv[0]) if "plugin" in kv[1] else (0, "", "")))
+def fixup_plugin(examples: List[Dict[str, Any]]):
+ # Boutique: plugin paths contain the build directory: change them to /usr/local/libexec/plugins/
+ def canonical(path: str) -> str:
+ return "/usr/local/libexec/plugins/" + path.split('/')[-1]
+
+ for ex in examples:
+ params = ex['request'].get('params')
+ if isinstance(params, dict) and 'plugin' in params:
+ params['plugin'] = canonical(params['plugin'])
+ for p in ex['response'].get('plugins', []):
+ p['name'] = canonical(p['name'])
+
+
def rewrite_examples(examples: Dict[str, Any]):
"""Despite being deterministic, some thing still need fixing up"""
@@ -349,6 +362,9 @@ def rewrite_examples(examples: Dict[str, Any]):
lc_response = examples['listconfigs']['examples'][2]['response']
lc_response['configs'] = fixup_listconfigs(lc_response['configs'])
+ # Canonicalize plugin paths in plugin start/stop/list examples
+ fixup_plugin(examples['plugin']['examples'])
+
for rw in rewrites:
rewrite_example(examples, rw)
Why this scored 15/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.