Skip to content

Commit a6afd15

Browse files
authored
Merge pull request DeusData#1521 from lukiod/test/mcp-fuzz-wrong-types
test: cover wrong JSON types in the MCP robustness layer
2 parents 076c8ae + f8d4855 commit a6afd15

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎scripts/security-fuzz.sh‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,19 @@ test_payload "wrong jsonrpc version" '{"jsonrpc":"1.0","id":2,"method":"tools/ca
115115
test_payload "array instead of object" '[1,2,3]'
116116
test_payload "deeply nested json" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":{"name_pattern":{"a":{"b":{"c":{"d":{"e":{"f":"deep"}}}}}}}}}'
117117

118+
echo ""
119+
echo "--- Wrong JSON types ---"
120+
121+
test_payload "null tool name" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":null,"arguments":{}}}'
122+
test_payload "numeric tool name" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":42,"arguments":{}}}'
123+
test_payload "object tool name" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":{"a":1},"arguments":{}}}'
124+
test_payload "array arguments" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":[1,2]}}'
125+
test_payload "string arguments" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":"nope"}}'
126+
test_payload "null arguments" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"search_graph","arguments":null}}'
127+
test_payload "array params" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":[1,2]}'
128+
test_payload "numeric params" '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":7}'
129+
test_payload "numeric method" '{"jsonrpc":"2.0","id":2,"method":7,"params":{}}'
130+
118131
echo ""
119132
echo "--- Oversized inputs ---"
120133

0 commit comments

Comments
 (0)