Open
Description
Real-Time Authorization
When subscribing to the events of a wallet, the client should verify that he owns the wallet.
This can be done by passing a token created with the /auth/token
API when subscribing to the wallet.
Discussion
Should we use the authorization method when connecting ($connect
route) instead of when subscribing to the wallet?
- By enforcing that only wallet owners can connect to the API Gateway Websocket, we can mitigate DOS attacks. Too many connections on the API Gateway will consume our resources, also each connection will create at least one key in our Redis instance, creating too many may overload the instance and DOS the actual users.
- If we expand the use of websockets to use cases where a wallet subscription is not needed, another authentication method will have to be developed (this is not a drawback, only an observation).
- In this case, if no alternative authentication method is developed, we would be open to a DOS attack described above.
- This way we can enforce a limit of open connections for a given wallet.
- This may impede having one connection for multiple wallets (if such feature is desired).