fix: add path traversal protection to get_workflow_tool + tests (#325)
PR #326 added _validate_name() to create/update/delete but missed get_workflow_tool, which would raise an unhandled ValueError instead of returning a user-friendly error. Added try/except handling and 6 tests covering all 4 tool functions with malicious names. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -135,6 +135,10 @@ def get_workflow_tool(args: dict) -> list:
|
||||
name = args.get("name", "").strip()
|
||||
if not name:
|
||||
return [TextContent(type="text", text="Error: 'name' parameter is required.")]
|
||||
try:
|
||||
_validate_name(name)
|
||||
except ValueError as exc:
|
||||
return [TextContent(type="text", text=f"Error: {exc}")]
|
||||
|
||||
text = _read_workflow(name)
|
||||
if text is None:
|
||||
|
||||
Reference in New Issue
Block a user