Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websocket library discussion #331

Closed
haerdib opened this issue Aug 2, 2021 · 7 comments
Closed

Websocket library discussion #331

haerdib opened this issue Aug 2, 2021 · 7 comments
Labels
F9-question Further information is requested

Comments

@haerdib
Copy link
Contributor

haerdib commented Aug 2, 2021

our current ws libray is not maintained anymore due to its owner being retired (see the issue).

Substrate itself seems to be using its own fork of this library, atleast for the json rpc interface.

it might be worth a thought to switch to this library. Or another maintained fork of ws-rs, which still seems to be the best choice for simple ws connections. If we switch to TLS completely, rustls will be another option, but it does not offer a ws connection without tls.

@haerdib haerdib added the F9-question Further information is requested label Aug 2, 2021
@murerfel
Copy link
Contributor

murerfel commented Aug 2, 2021

I believe @clangenb uses https://github.com/paritytech/jsonrpsee in some parts of the untrusted worker. In light of #202 , where we want to have a secure websocket server directly in the enclave, we'd need another library still, because https://github.com/paritytech/jsonrpsee cannot be run inside the enclave, afaik (it uses tokio, which cannot be run in no_std)? That would mean we might need more than 1 WebSocket library?

Moreover, we have several security issues reported by cargo audit that originate in the ws library (see #189 ), because it's not being maintained anymore. So it would be a good step for sure to replace the ws library.

@haerdib
Copy link
Contributor Author

haerdib commented Aug 2, 2021

I only quickly glanced over https://github.com/paritytech/jsonrpsee but it does not seem to be a simple ws but a ws optimized for jsonrpc. I don't think that's what we will be able to use for #202 because the ws-server, if implemented on std side, will only be forwarding the received messages, it will not handle them as rpc calls. If implemented within the enclave, ws-rs as well as jsonrpsee are not an option, because of no-std, yes.

As I said - I only quickly glanced over it, so I'd love to stand corrected here.

@clangenb
Copy link
Contributor

clangenb commented Aug 2, 2021

  1. For connections that reach inside the enclave, the sgx rustls fork is probably the only option. Which is fine, we don't need websockets inside the enclave without tls.

  2. I suppose we only use the ws-rs crate on the untrusted side. There, I recommend using jsonrpsee, which will automatically get rid of the ws dependency. (If we even need untrusted websockets in case we have tls setup in the enclave)

@haerdib
Copy link
Contributor Author

haerdib commented Aug 2, 2021

I guess this depends alot on the decision of issue #202. If it's okay for you, I'd like to keep this issue open until we've decided what to go for.. (I'd like to keep the links here)

@clangenb
Copy link
Contributor

clangenb commented Aug 2, 2021

Fine with me as a memo. But I think I'd adjust the issue name to something that reflects the below:

After implementing #202

  • If a websocket is going to be maintained on the untrusted side, we switch that part completely to jsonrpsee.
  • If not, we don't use any websocket at all.

@haerdib
Copy link
Contributor Author

haerdib commented Aug 3, 2021

I'm not sure if I can agree to this comment. Because there might be usecases where a simple ws is necessary, without jsonrpc response handling. An example would be the current, untrusted ws to client side. It just forwards the received message, it doesn't read it.

@haerdib haerdib changed the title Switch from ws-rs to parity-ws? Websocket library discussion Mar 4, 2022
@haerdib
Copy link
Contributor Author

haerdib commented Mar 4, 2022

I'm closing this issue, as it's not an issue any more.

@haerdib haerdib closed this as completed Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F9-question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants