mojira.dev
MC-301531

Server Management Protocol returns wrong response for invalid method IDs

When the RPC request tries to call an unknown method, or the method name is not a valid namespace id, the server will return a weird response:

$ websocat ws://localhost:25585
{"jsonrpc":"2.0","method":"minecraft:server/stop2","id":1}
{"jsonrpc":"2.0","id":1,"result":{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found","data":"Method not found: minecraft:server/stop2"}}}
{"jsonrpc":"2.0","method":2,"id":2}
{"jsonrpc":"2.0","id":2,"result":{"jsonrpc":"2.0","id":2,"error":{"code":-32601,"message":"Method not found","data":"Method not found: 2"}}}
{"jsonrpc":"2.0","method":true,"id":3}
{"jsonrpc":"2.0","id":3,"result":{"jsonrpc":"2.0","id":3,"error":{"code":-32601,"message":"Method not found","data":"Method not found: true"}}}
{"jsonrpc":"2.0","id":4}
{"jsonrpc":"2.0","id":4,"error":{"code":-32600,"message":"Invalid Request"}}
{"jsonrpc":"2.0","method":"minecraft:minecraft:minecraft","id":5}
{"jsonrpc":"2.0","id":5,"result":{"jsonrpc":"2.0","id":5,"error":{"code":-32600,"message":"Invalid Request","data":"Failed to parse method value: minecraft:minecraft:minecraft"}}}

The response should be {"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"Method not found","data":"Method not found: minecraft:server/stop2"}}like the response at line 9, but it returns a successful result which contains a valid JSON-RPC error response.

Comments 0

No comments.

Nickid2018

Jonatan

Plausible

Platform

Low

Networking

25w35a

Retrieved