jcrodriguez-dis / vpl-jail-system

Execution/jail server for VPL
GNU General Public License v3.0
23 stars 22 forks source link

JSON-RPC: "root must have 3 attributes" for compliant requests #71

Closed jeroenhabets closed 2 weeks ago

jeroenhabets commented 11 months ago

Hi @jcrodriguez-dis,

Our developer reported that the VPL JSON-RPC gives a "RPC/JSON root must have 3 attributes" error, raised here:

https://github.com/jcrodriguez-dis/vpl-xmlrpc-jail/blob/f04c05d8a391184603641ed07443eeadd60808f0/src/jsonrpc.h#L27-L33

If I read that code and the JSON-RPC standard for a request correctly ;if "params" is supplied the root must have 4 attributes, namely besides "params" and required "method", "id" also required "jsonrpc" (jsonrpc: "2.0").

I.e. the following is a JSON-RPC compliant request with 4 attributes:

{"jsonrpc": "2.0", "method": "subtract", "params": {"a": 42, "b": 23}, "id": 3}

NOTE: My developer has already coded a work-around a while ago so we're actually not looking for a fix ourselves (and our customers). Still perhaps it may be worth reviewing to confirm our hypothesis and if correct fixing this for others. If we're mistaken than apologies in advance for wasting your time.

jcrodriguez-dis commented 11 months ago

Dear @jeroenhabets,

Thank you for bringing this matter to our attention. Upon reviewing the code segment from vpl-xmlrpc-jail/src/jsonrpc.h, and cross-referencing it with the JSON-RPC standard, I concur that the issue you have identified appears to be a bug.

Thank you for taking the time to report this issue.

Best regards, @jcrodriguez-dis

jcrodriguez-dis commented 5 months ago

Dear @jeroenhabets,

The problem you reported has been resolved in 0f56a00.

Best regards, Juan Carlos.