ssbc/go-muxrpc

Malformed request sent when connecting to peers

Closed this issue · 3 comments

boreq commented

On connection go-muxrpc sends the following request to peers:

{
    "name": "manifest",
    "args": [],
    "type": "async"
}

This request is malformed as per the protocol guide request name is a list of strings:

The name is a list of strings. For a top-level procedure like createHistoryStream the list only has one element: ["createHistoryStream"].

https://ssbc.github.io/scuttlebutt-protocol-guide/#request-format

This means that the request should instead have the following form:

{
    "name": ["manifest"],
    "args": [],
    "type": "async"
}

Therefore it is possible that clients which reject connections from peers which send malformed requests will not be able to communicate with projects which use go-muxrpc.

I wish that was the case in practice.. a Manifest Call like that is allowed as a first request to bootstrap the set of possible calls as a first interaction.

Back when I encountered this I didn't find a better way to introduce this semantic on the Go side then allow for an opaque string as well instead of only arrays. PR welcome.

There is some gory background and details like the initial JS bootstrapping PR in this issue: ssbc/secret-stack#71

boreq commented

In that case we should try documenting this in the protocol guide. I don't really feel like I know enough to do this but I will try getting up to speed using this link and maybe I will manage to create some docs for it. That being said the fact that the name field uses a different type out of the sudden is quite awkward in my opinion.

As a side note I have not seen this behavior when connecting to other clients. Maybe it would be possible to streamline this call in the future and make it conform to the format of all other requests. As of now it violates the protocol guide which is not a great idea.

Feel free to close this issue.

By the way I started documenting various RPC calls as I couldn't find any docs that try to catalog all of them. This effort will unfortunately take a lot of time to complete. Ideally in the future this would get moved to the official SSB docs.

https://dev.planetary.social/rpc/manifest.html

Thanks for your documentation work @boreq. Much appreicated!