solid-nextcloud icon indicating copy to clipboard operation
solid-nextcloud copied to clipboard

Secure WebSockets

Open michielbdejong opened this issue 3 years ago • 3 comments

The new Notifications protocol that is expected to become required in addition to the current pubsub protocol requires:

  • a new discovery mechanism, same as for webhooks
  • auth checks, same as for webhooks
  • a new pub format, same as for webhooks

So far I created the rudimentary https://github.com/pdsinterop/solid-nextcloud/blob/main/solid/lib/Controller/SolidWebsocketController.php which points to the old pubsub server.

I thought of a way to improve this:

  • add a second port to the pubsub server
  • when a client subscribes, create a corresponding webhook subscription, but as the target, put the new port of the pubsub server + an auth token
  • give the URL with auth token to the client
  • the pubsub server second port forwards webhook messages into the open websocket (if any) that matches its token

michielbdejong avatar Oct 06 '22 06:10 michielbdejong

Ah wait, the webhook sends a POST body, not a GET query, of course.

michielbdejong avatar Oct 07 '22 14:10 michielbdejong

OCA\\Solid\\Controller\\SolidWebhookController::registerWs(): Argument #1 ($topic) must be of type string, null given, called in /var/www/html/lib/private/AppFramework/Http/Dispatcher.php on line 225

michielbdejong avatar Oct 07 '22 14:10 michielbdejong

Got the tests passing on my laptop, now let's see if they also pass in GitHub Actions.

michielbdejong avatar Oct 07 '22 15:10 michielbdejong